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