Submission #1115952
Source Code Expand
#include <stdio.h> int a[100010]; char c[100010]; int main(){ int i,j,k,l,n; scanf("%d%s",&n,c+1); for(i=0;i<2;++i){ a[1]=i; for(j=0;j<2;++j){ a[2]=j; for(k=0;k<2;++k){ a[3]=k; for(l=3;l<n;++l){ if(a[l]){ if(c[l]=='o')a[l+1]=a[l-1]; else a[l+1]=!a[l-1]; } else{ if(c[l]=='o')a[l+1]=!a[l-1]; else a[l+1]=a[l-1]; } } a[0]=a[n],a[n+1]=a[1]; for(l=1;l<=n;++l){ if(a[l]){ if(c[l]=='o'&&a[l-1]!=a[l+1])break; if(c[l]=='x'&&a[l-1]==a[l+1])break; } else{ if(c[l]=='o'&&a[l-1]==a[l+1])break; if(c[l]=='x'&&a[l-1]!=a[l+1])break; } } if(l>n){ for(l=1;l<=n;++l)printf(a[l]?"S":"W"); return 0; } } } } puts("-1"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | eaststar |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1260 Byte |
Status | AC |
Exec Time | 8 ms |
Memory | 768 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:6:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%s",&n,c+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 | 128 KB |
00_example_02.txt | AC | 0 ms | 128 KB |
00_example_03.txt | AC | 0 ms | 128 KB |
01.txt | AC | 4 ms | 512 KB |
02.txt | AC | 3 ms | 384 KB |
03.txt | AC | 1 ms | 128 KB |
04.txt | AC | 1 ms | 128 KB |
05.txt | AC | 6 ms | 640 KB |
06.txt | AC | 8 ms | 768 KB |
07.txt | AC | 1 ms | 256 KB |
08.txt | AC | 2 ms | 256 KB |
09.txt | AC | 1 ms | 128 KB |
10.txt | AC | 1 ms | 256 KB |
11.txt | AC | 5 ms | 768 KB |
12.txt | AC | 6 ms | 768 KB |
13.txt | AC | 6 ms | 768 KB |