Submission #1115947


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back
#define sz(a) int((a).size())
#define all(a)  a.begin(), a.end()
#define	debug(ccc)	cout << #ccc << " = " << ccc << endl;
#define present(c,x) ((c).find(x) != (c).end())
const double eps = 1e-8;
#define EQ(a,b) (fabs((a)-(b))<eps)
inline int max(int a,int b){return a<b?b:a;}
inline int min(int a,int b){return a>b?b:a;}
inline ll max(ll a,ll b){return a<b?b:a;}
inline ll min(ll a,ll b){return a>b?b:a;}
const int mod = 1e9+7;
const int N = 1e6+10;
const ll inf = 1e18;

ll power(ll a,ll n){
	if(n==0){
		return 1;
	}
	ll b = power(a,n/2);
	b = b*b%mod;
	if(n%2) b= b*a%mod;
	return b;
}

int add(int a,int b){ return (a+b)%mod;}
int mul(int a,int b){ return (ll)a*b%mod;}


char s[N];
int A[N],B[N];

int main(){
 // 	freopen("nice.in","r",stdin);
 // freopen("nice.out","w",stdout);
	int n; scanf("%d %s",&n,s);
	REP(i,n) A[i] = (s[i]=='x');
	REP(i,2) REP(j,2){
		B[0] = i, B[1] = j;
		REPP(k,2,n){
			B[k] = A[k-1]^B[k-2]^B[k-1]; 
		}
		int f = 1;
		REP(k,2*n){
			if(B[k%n]!= B[(k-1+n)%n]^B[(k-2+n)%n]^A[(k-1+n)%n]) f=0;
		}
		if(f){
			REP(i,n){
				if(!B[i]) printf("S");
				else printf("W");
			}
			printf("\n");return 0;
		}
	}
	printf("-1\n");
	return 0;
}


Submission Info

Submission Time
Task D - Menagerie
User sahilgrover
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1678 Byte
Status AC
Exec Time 11 ms
Memory 6912 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:49:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  int n; 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 2 ms 4352 KB
00_example_02.txt AC 2 ms 4352 KB
00_example_03.txt AC 2 ms 4352 KB
01.txt AC 7 ms 6656 KB
02.txt AC 4 ms 4608 KB
03.txt AC 2 ms 4352 KB
04.txt AC 2 ms 4352 KB
05.txt AC 9 ms 6784 KB
06.txt AC 6 ms 6784 KB
07.txt AC 3 ms 4352 KB
08.txt AC 3 ms 4480 KB
09.txt AC 2 ms 4352 KB
10.txt AC 4 ms 4352 KB
11.txt AC 11 ms 6912 KB
12.txt AC 11 ms 6912 KB
13.txt AC 9 ms 6912 KB