Submission #1119731
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<bool> ans(N); vector<bool> res(N); for(int i=0;i<N;++i){ ans[i] = str[i] == 'x'; } bool flag; for(int i=0;i<4;++i){ flag = true; res[0] = (i/2)>0; res[1] = (i%2)>0; for(int j=1;j+1<N;++j){ res[(j+1)%N] = (res[(j)%N]+res[(j+N-1)%N]+ans[j] )%2 > 0; } for(int j=N-3;j<N;++j){ if( (res[(j+N-1)%N]+res[j%N]+res[(j+1)%N])%2 > 0 != ans[j%N] ){ flag = false; break; } } if( flag ){ for(int j=0;j<N;++j){ if( res[j] ){ cout << "W"; }else{ cout << "S"; } } 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 | 0 |
Code Size | 2102 Byte |
Status | WA |
Exec Time | 8 ms |
Memory | 592 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||||
Status |
|
|
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 | WA | 6 ms | 512 KB |
02.txt | AC | 4 ms | 384 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | WA | 8 ms | 512 KB |
06.txt | AC | 6 ms | 512 KB |
07.txt | WA | 2 ms | 256 KB |
08.txt | AC | 2 ms | 256 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | WA | 2 ms | 256 KB |
11.txt | WA | 7 ms | 592 KB |
12.txt | WA | 7 ms | 592 KB |
13.txt | WA | 8 ms | 592 KB |