Submission #1368452
Source Code Expand
#include <bits/stdc++.h> #define lld long long #define pp pair<int,int> #define pb push_back #define MOD 10007 #define left lleft #define right rright #define INF 2000000000 #define LINF 1000000000000000000LL #define next nnext using namespace std; int N; int a[100002]; char s[100002]; void process(){ for(int i=2; i<N; i++){ if(a[i] == 1){ if(s[i-1] == 'o') a[i+1] = a[i-1]; else a[i+1] = 3-a[i-1]; }else{ if(s[i-1] == 'o') a[i+1] = 3-a[i-1]; else a[i+1] = a[i-1]; } } } int main(){ scanf("%d",&N); scanf("%s",s); for(a[1]=1; a[1]<=2; a[1]++){ for(a[2]=1; a[2]<=2; a[2]++){ process(); bool flag = true; if(a[1] == 1){ if(s[0] == 'o' && a[N] != a[1]) flag = false; else if(s[0] == 'x' && a[N] == a[1]) flag = false; }else{ if(s[0] == 'o' && a[N] == a[1]) flag = false; else if(s[0] == 'x' && a[N] != a[1]) flag = false; } if(a[N] == 1){ if(s[N-1] == 'o' && a[N-1] != a[1]) flag = false; else if(s[N-1] == 'x' && a[N-1] == a[1]) flag = false; }else{ if(s[N-1] == 'o' && a[N-1] == a[1]) flag = false; else if(s[N-1] == 'x' && a[N-1] != a[1]) flag = false; } if(flag){ for(int k=1; k<=N; k++) printf("%c",a[k]==1?'S':'W'); puts(""); return 0; } } } puts("-1"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | suhgyuho |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1343 Byte |
Status | WA |
Exec Time | 4 ms |
Memory | 768 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:32:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&N); ^ ./Main.cpp:33:15: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s",s); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 3 ms | 640 KB |
02.txt | AC | 2 ms | 512 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | WA | 1 ms | 256 KB |
05.txt | WA | 3 ms | 768 KB |
06.txt | AC | 3 ms | 768 KB |
07.txt | WA | 2 ms | 384 KB |
08.txt | WA | 2 ms | 384 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | WA | 2 ms | 384 KB |
11.txt | AC | 4 ms | 768 KB |
12.txt | AC | 4 ms | 768 KB |
13.txt | WA | 3 ms | 768 KB |