Submission #2044582


Source Code Expand

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
char in[110000];
int q[110000]; // 1: tozan 0: beau
int main(){
	int a;scanf("%d%s",&a,in);
	for(int i=0;i<2;i++)for(int j=0;j<2;j++){
		q[0]=i;q[1]=j;
		for(int k=2;k<a;k++){
			int s=(in[k-1]=='o');
			int t=q[k-1];
			if(s^t){
				q[k]=q[k-2];
			}else{
				q[k]=!q[k-2];
			}
		}
		bool ok=true;
		for(int k=0;k<a;k++){
			int s=(in[k]=='o');
			int t=q[k];
			if(s^t){
				if(q[(k+a-1)%a]!=q[(k+1)%a])ok=false;
			}else{
				if(q[(k+a-1)%a]==q[(k+1)%a])ok=false;
			}
		}
		if(ok){
			for(int k=0;k<a;k++){
				if(!q[k])printf("S");
				else printf("W");
			}
			printf("\n");return 0;
		}
	}
	printf("-1\n");
}

Submission Info

Submission Time
Task D - Menagerie
User tozangezan
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1172 Byte
Status AC
Exec Time 9 ms
Memory 768 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:27:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  int a;scanf("%d%s",&a,in);
                           ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 16
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 1 ms 128 KB
00_example_03.txt AC 1 ms 128 KB
01.txt AC 5 ms 512 KB
02.txt AC 2 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 3 ms 640 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 2 ms 256 KB
11.txt AC 9 ms 768 KB
12.txt AC 9 ms 768 KB
13.txt AC 7 ms 768 KB