Submission #2239323
Source Code Expand
#include<stdio.h> #include<stdlib.h> #define ll long long #define rep(i,l,r)for(ll i=(l);i<(r);i++) char ans[100010],s[100010]; int n; void f(){ rep(i,2,n){ if((ans[i-1]=='S')^(s[i-1]=='o'))ans[i]=-ans[i-2]+'S'+'W'; else ans[i]=ans[i-2]; } if(((ans[n-2]==ans[0])^(s[n-1]=='o')^(ans[n-1]=='S')) &&((ans[n-1]==ans[1])^(s[0]=='o')^(ans[0]=='S'))){ puts(ans); exit(0); } } int main(){ scanf("%d%s",&n,s); ans[0]='S';ans[1]='S';f(); ans[0]='S';ans[1]='W';f(); ans[0]='W';ans[1]='S';f(); ans[0]='W';ans[1]='W';f(); puts("-1"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | kyopro_friends |
Language | C (GCC 5.4.1) |
Score | 500 |
Code Size | 584 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 512 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:22:2: warning: ignoring return value of ‘scanf’, 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 | 0 ms | 128 KB |
00_example_02.txt | AC | 1 ms | 128 KB |
00_example_03.txt | AC | 0 ms | 128 KB |
01.txt | AC | 2 ms | 384 KB |
02.txt | AC | 1 ms | 256 KB |
03.txt | AC | 1 ms | 128 KB |
04.txt | AC | 0 ms | 128 KB |
05.txt | AC | 2 ms | 384 KB |
06.txt | AC | 1 ms | 384 KB |
07.txt | AC | 1 ms | 256 KB |
08.txt | AC | 1 ms | 256 KB |
09.txt | AC | 1 ms | 128 KB |
10.txt | AC | 1 ms | 256 KB |
11.txt | AC | 3 ms | 512 KB |
12.txt | AC | 3 ms | 384 KB |
13.txt | AC | 3 ms | 384 KB |