Submission #1368437
Source Code Expand
#include <bits/stdc++.h> using namespace std; int n; int arr[100100]; int res[100100]; char str[100100]; bool test() { int i; for (i=1;i<=n;i++) arr[i+1] = arr[i]^res[i]^arr[i-1]; return (arr[0]==arr[n])&&(arr[1]==arr[n+1]); } void print() { int i; for (i=0;i<n;i++) printf("%c",((arr[i])?'W':'S')); exit(0); } int main() { int i, j; scanf("%d",&n); scanf("%s",str); for (i=0;i<=n;i++) res[i] = (str[i%n]=='x'); for (i=0;i<2;i++) for (j=0;j<2;j++) { arr[0] = i; arr[1] = j; if (test()) print(); } printf("-1\n"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | tlwpdus |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 644 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 1280 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:23:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:24:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s",str); ^
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 | 896 KB |
02.txt | AC | 2 ms | 640 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 3 ms | 1152 KB |
06.txt | AC | 3 ms | 1152 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 | 1152 KB |
12.txt | AC | 3 ms | 1280 KB |
13.txt | AC | 3 ms | 1280 KB |