Submission #2831398
Source Code Expand
#include <bits/stdc++.h> using namespace std; int reverse(char s) { if (s == 'S') return 'W'; if (s == 'W') return 'S'; return 0; } int may_reverse(bool flag, char s) { if (flag) { if (s == 'S') return 'W'; if (s == 'W') return 'S'; } return s; } int prev(int i, int n) { if (--i < 0) return n-1; return i; } int next(int i, int n) { if (n <= ++i) return 0; return i; } void check(const string& s, string& assume) { for (int i = 0; i < s.size(); ++i) { if (assume[i] == 'W') { assume[next(i, s.size())] = may_reverse(s[i] == 'o', assume[prev(i, s.size())]); } else { assume[next(i, s.size())] = may_reverse(s[i] == 'x', assume[prev(i, s.size())]); } } } void init(string& s, int len) { for (int i = 0; i < len; ++i) { s[i] = ' '; } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; string s; cin >> n >> s; char type[] = "SW"; for (int i = 0; i < 2; ++i) { for (int j = 0; j < 2; ++j) { string assume(' ', n + 1); assume[0] = type[i]; assume[n-1] = type[j]; check(s, assume); string result(&assume[0], n); if (result[0] == type[i]) { cout << result << "\n"; return 0; } } } cout << -1 << "\n"; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | kumagi |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1339 Byte |
Status | RE |
Exec Time | 100 ms |
Memory | 592 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt |
All | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 1 ms | 256 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
00_example_03.txt | AC | 1 ms | 256 KB |
01.txt | RE | 99 ms | 384 KB |
02.txt | RE | 98 ms | 384 KB |
03.txt | RE | 97 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | RE | 99 ms | 512 KB |
06.txt | RE | 99 ms | 512 KB |
07.txt | RE | 97 ms | 384 KB |
08.txt | RE | 98 ms | 384 KB |
09.txt | RE | 98 ms | 256 KB |
10.txt | RE | 98 ms | 384 KB |
11.txt | RE | 100 ms | 592 KB |
12.txt | RE | 99 ms | 592 KB |
13.txt | RE | 99 ms | 512 KB |