Submission #1813848
Source Code Expand
#include<iostream> #include<string> using namespace std; int n; string s, t[2] = {"S", "W"}; string solve(){ for(int i = 0; i < 2; i++) for(int j = 0; j < 2; j++){ string res = t[i] + t[j]; for(int k = 1; k < n - 1; k++){ if(res[k] == 'S' && s[k] == 'o' || res[k] == 'W' && s[k] == 'x') res += res[k - 1]; else res += (res[k - 1] == 'S' ? 'W' : 'S'); } if(res[0] == 'S' && s[0] == 'o' || res[0] == 'W' && s[0] == 'x'){ if(res[1] != res[n - 1]) continue; } else{ if(res[1] == res[n - 1]) continue; } if(res[n - 1] == 'S' && s[n - 1] == 'o' || res[n - 1] == 'W' && s[n - 1] == 'x'){ if(res[0] != res[n - 2]) continue; } else{ if(res[0] == res[n - 2]) continue; } return res; } return "-1"; } int main(){ cin >> n >> s; cout << solve() << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | orpheus |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 813 Byte |
Status | AC |
Exec Time | 10 ms |
Memory | 640 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 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 | AC | 6 ms | 512 KB |
02.txt | AC | 3 ms | 512 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 8 ms | 640 KB |
06.txt | AC | 5 ms | 640 KB |
07.txt | AC | 2 ms | 256 KB |
08.txt | AC | 2 ms | 384 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 3 ms | 384 KB |
11.txt | AC | 10 ms | 640 KB |
12.txt | AC | 10 ms | 640 KB |
13.txt | AC | 8 ms | 640 KB |