Submission #1115967
Source Code Expand
#include <bits/stdc++.h> using namespace std; inline char op(char c) { return c == 'S' ? 'W' : 'S'; } int main() { cin.tie(0); ios_base::sync_with_stdio(false); int n; cin >> n; string a; cin >> a; string t; for (int i = 0; i <= n; i++) { t.push_back(' '); } for (int f = 0; f < 2; f++) { for (int s = 0; s < 2; s++) { t[0] = (f == 0 ? 'S' : 'W'); t[1] = (s == 0 ? 'S' : 'W'); for (int i = 1; i < n; i++) { if (t[i] == 'S') { if (a[i] == 'o') { t[i + 1] = t[i - 1]; } else { t[i + 1] = op(t[i - 1]); } } else { if (a[i] == 'o') { t[i + 1] = op(t[i - 1]); } else { t[i + 1] = t[i - 1]; } } } if (t[n] == t[0] and t[n - 1] == t[1]) { t.resize(n); cout << t << endl; return 0; } } } cout << -1 << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | Dener |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1241 Byte |
Status | WA |
Exec Time | 5 ms |
Memory | 640 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 | WA | 3 ms | 512 KB |
02.txt | AC | 2 ms | 512 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | WA | 4 ms | 640 KB |
06.txt | AC | 2 ms | 640 KB |
07.txt | WA | 2 ms | 384 KB |
08.txt | WA | 2 ms | 384 KB |
09.txt | WA | 1 ms | 256 KB |
10.txt | WA | 1 ms | 384 KB |
11.txt | WA | 5 ms | 592 KB |
12.txt | WA | 5 ms | 592 KB |
13.txt | WA | 5 ms | 592 KB |