Submission #2216389


Source Code Expand

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int n;
	string s;
	char c[2]={'S','W'};
	string ans="";
	cin>>n>>s;
	FOR(a1,0,2){
		FOR(a2,0,2){
			ans="";
			ans+=c[a1];
			ans+=c[a2];
			FOR(i,1,n){
				if(ans[i]=='S'){
					if(s[i]=='o'){
						ans+=ans[i-1];
					}else{
						if(ans[i-1]=='S')ans+=c[1];
						else ans+=c[0];
					}
				}else{
					if(s[i]=='o'){
						if(ans[i-1]=='S')ans+=c[1];
						else ans+=c[0]; 
					}else{
						ans+=ans[i-1];
					}
				}
			}
			if(ans[0]==ans[n]){
				if(ans[0]=='S'&&s[0]=='o'){
					if(ans[n-1]!=ans[1])continue;
				}else if(ans[0]=='S'&&s[0]=='x'){
					if(ans[n-1]==ans[1])continue;
				}else if(ans[0]=='W'&&s[0]=='o'){
					if(ans[n-1]==ans[1])continue;
				}else{
					if(ans[n-1]!=ans[1])continue;
				}
				FOR(i,0,n){
					cout<<ans[i];
				}
				cout<<endl;
				return 0;
			}
		}
	}
	cout<<-1<<endl;

    return 0;
}

Submission Info

Submission Time
Task D - Menagerie
User kt_tenel
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1886 Byte
Status AC
Exec Time 13 ms
Memory 640 KB

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 8 ms 512 KB
02.txt AC 5 ms 512 KB
03.txt AC 1 ms 256 KB
04.txt AC 1 ms 256 KB
05.txt AC 10 ms 640 KB
06.txt AC 8 ms 640 KB
07.txt AC 3 ms 256 KB
08.txt AC 3 ms 384 KB
09.txt AC 1 ms 256 KB
10.txt AC 3 ms 256 KB
11.txt AC 13 ms 640 KB
12.txt AC 13 ms 640 KB
13.txt AC 11 ms 640 KB