Submission #1499588
Source Code Expand
#include <bits/stdc++.h> using namespace std; const int N = 1e5+5; char s[N]; bool a[N]; int n; int main() { scanf("%d%s",&n,s); for(int i = 0; i < 4; ++i) { a[0] = i&1, a[1] = (i&2)>>1; for(int j = 2; j < n; ++j) { a[j] = a[j-2]; if(a[j-1] ^ (s[j-1] == 'x')) a[j] ^= 1; } if((a[1] == a[n-1]) != ((s[0] == 'o')^a[0])) continue; if((a[0] == a[n-2]) != ((s[n-1] == 'o')^a[n-1])) continue; for(int i = 0; i < n; ++i) { if(a[i]) printf("W"); else printf("S"); } printf("\n"); return 0; } printf("-1\n"); }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | cephian |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 562 Byte |
Status | AC |
Exec Time | 5 ms |
Memory | 512 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:9:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%s",&n,s); ^
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 | 3 ms | 384 KB |
02.txt | AC | 2 ms | 384 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 3 ms | 512 KB |
06.txt | AC | 3 ms | 512 KB |
07.txt | AC | 1 ms | 256 KB |
08.txt | AC | 2 ms | 256 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 1 ms | 256 KB |
11.txt | AC | 5 ms | 512 KB |
12.txt | AC | 5 ms | 512 KB |
13.txt | AC | 4 ms | 512 KB |