Submission #1119864


Source Code Expand

#ifdef __GNUC__
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#endif

#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>

#include <string>
#include <cstring>
#include <vector>
#include <valarray>
//#include <array>//x C++ (G++ 4.6.4)

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <cassert>//assert();
#include <fstream>
#include <random>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)

/////////
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#define PII pair<int,int>
/////////
using namespace::std;

// 最大公約数
template<class T>
inline T gcd(T a, T b){return b ? gcd(b, a % b) : a;}
//inline T gcd(T a, T b){return b == 0 ? a : gcd(b, a % b);}
/*inline T gcd(T a,T b){
	while(b != 0 ){
		a = a % b;
		swap(a,b);
	}
	return a;
}*/

// 最小公倍数
template<class T>
inline T lcm(T a, T b){return a / gcd(a, b) * b;}
//inline T lcm(T a, T b){return a * b / gcd(a, b);}
////////////////////////////////

inline void solve(){
	int N;
	string str;
	cin >> N >> str;
	vector<int> ans(N);
	vector<int> ani(N);
	for(int i=0;i<N;++i){
		ans[i] = str[i] == 'x';
	}
	bool flag;
	for(int i=0;i<4;++i){
		flag = true;
		ani[0] = (i/2);
		ani[1] = (i%2);
		for(int j=0;j+2<N;++j){
			ani[j+2] = (ani[j]+ani[j+1]+ans[j+1] )%2;
		}
		
		if( (ani[N-2] +ani[N-1]+ans[N-1])%2  != ani[0] )continue;
		if( (ani[N-1] +ani[0]+ans[0])%2 != ani[1] )continue;
		
		for(int j=0;j<N;++j){
			cout << (char)('S' + ani[j]*4);
		}
		cout << endl;
		return;
	}
	cout << -1 << endl;
}

signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	//std::cout << std::fixed;//小数を10進数表示
	//cout << setprecision(16);//小数点以下の桁数を指定
	
	solve();
}

Submission Info

Submission Time
Task D - Menagerie
User akarin55
Language C++14 (GCC 5.4.1)
Score 500
Code Size 2004 Byte
Status AC
Exec Time 5 ms
Memory 1360 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 1024 KB
02.txt AC 3 ms 768 KB
03.txt AC 1 ms 256 KB
04.txt AC 1 ms 256 KB
05.txt AC 5 ms 1280 KB
06.txt AC 4 ms 1280 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 1 ms 512 KB
11.txt AC 5 ms 1360 KB
12.txt AC 5 ms 1360 KB
13.txt AC 5 ms 1360 KB