Submission #1681086


Source Code Expand

#include <bits/stdc++.h>

#define mp make_pair
#define pb push_back

using namespace std;

int n;
char s[111111], an[111111];

int main(){
//	freopen("input.inp", "r", stdin);
	scanf("%d%s",&n,&s);
	for(int p = 0; p < 2; ++p){
		for(int q = 0; q < 2; ++q){
			if (p == 0) an[0] = 'W'; else an[0] = 'S';
			if (q == 0) an[1] = 'W'; else an[1] = 'S';
			for(int i = 2; i < n; ++i){
				if (an[i - 1] == 'S' && s[i - 1] == 'o') an[i] = an[i - 2];
				if (an[i - 1] == 'S' && s[i - 1] == 'x'){
					if (an[i - 2] == 'W') an[i] = 'S';
					else an[i] = 'W';
				}
				if (an[i - 1] == 'W' && s[i - 1] == 'x') an[i] = an[i - 2];
				if (an[i - 1] == 'W' && s[i - 1] == 'o'){
					if (an[i - 2] == 'W') an[i] = 'S';
					else an[i] = 'W';					
				}
			}
			if (an[0] == 'S' && s[0] == 'o' && an[n - 1] != an[1]) continue;
			if (an[0] == 'S' && s[0] == 'x' && an[n - 1] == an[1]) continue;
			if (an[0] == 'W' && s[0] == 'o' && an[n - 1] == an[1]) continue;
			if (an[0] == 'W' && s[0] == 'x' && an[n - 1] != an[1]) continue;
			if (an[n - 1] == 'S' && s[n - 1] == 'o' && an[n - 2] != an[0]) continue;
			if (an[n - 1] == 'S' && s[n - 1] == 'x' && an[n - 2] == an[0]) continue;
			if (an[n - 1] == 'W' && s[n - 1] == 'o' && an[n - 2] == an[0]) continue;
			if (an[n - 1] == 'W' && s[n - 1] == 'x' && an[n - 2] != an[0]) continue;			
			printf("%s",an);
			return 0;
		}
	}
	printf("-1");
	return 0;
}

Submission Info

Submission Time
Task D - Menagerie
User Minology
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1437 Byte
Status AC
Exec Time 4 ms
Memory 512 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:13:20: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘char (*)[111111]’ [-Wformat=]
  scanf("%d%s",&n,&s);
                    ^
./Main.cpp:13:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, 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
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 256 KB
00_example_02.txt AC 1 ms 256 KB
00_example_03.txt AC 1 ms 256 KB
01.txt AC 2 ms 384 KB
02.txt AC 2 ms 384 KB
03.txt AC 1 ms 256 KB
04.txt AC 1 ms 256 KB
05.txt AC 3 ms 512 KB
06.txt AC 4 ms 512 KB
07.txt AC 1 ms 256 KB
08.txt AC 2 ms 256 KB
09.txt AC 1 ms 256 KB
10.txt AC 2 ms 256 KB
11.txt AC 2 ms 512 KB
12.txt AC 2 ms 512 KB
13.txt AC 3 ms 512 KB