Submission #1800397


Source Code Expand

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	int n;
	string s;
	cin>>n>>s;
	s += s[0];
	rep(i, 4){
		vector<int> v(n+2);
		v[0] = i%2; v[1] = i/2;
		for(int j = 1; j <= n; j++){
			int t = s[j]=='x';
			if(v[j]==1) t = !t;
			v[j+1] = v[j-1]^t;
		}
		if(v[0]==v[n] && v[1]==v[n+1]){
			string res = "";
			rep(k, n) res += (v[k]?'W':'S');
			cout<<res<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
	return 0;
}

Submission Info

Submission Time
Task D - Menagerie
User Lepton
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1560 Byte
Status AC
Exec Time 8 ms
Memory 1052 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 4 ms 772 KB
02.txt AC 3 ms 640 KB
03.txt AC 1 ms 256 KB
04.txt AC 1 ms 256 KB
05.txt AC 6 ms 1052 KB
06.txt AC 5 ms 1024 KB
07.txt AC 2 ms 384 KB
08.txt AC 2 ms 384 KB
09.txt AC 1 ms 256 KB
10.txt AC 2 ms 384 KB
11.txt AC 8 ms 1016 KB
12.txt AC 8 ms 1016 KB
13.txt AC 6 ms 1016 KB