Contest Duration: ~ (local time) (100 minutes) Back to Home

Submission #1115528

Source Code Expand

Copy
```// hloya template v24

// ░░░░░░░▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄░░░░░░
// ░░░░░░█░░▄▀▀▀▀▀▀▀▀▀▀▀▀▀▄░░█░░░░░
// ░░░░░░█░█░▀░░░░░▀░░▀░░░░█░█░░░░░
// ░░░░░░█░█░░░░░░░░▄▀▀▄░▀░█░█▄▀▀▄░
// █▀▀█▄░█░█░░▀░░░░░█░░░▀▄▄█▄▀░░░█░
// ▀▄▄░▀██░█▄░▀░░░▄▄▀░░░░░░░░░░░░▀▄
// ░░▀█▄▄█░█░░░░▄░░█░░░▄█░░░▄░▄█░░█
// ░░░░░▀█░▀▄▀░░░░░█░██░▄░░▄░░▄░███
// ░░░░░▄█▄░░▀▀▀▀▀▀▀▀▄░░▀▀▀▀▀▀▀░▄▀░
// ░░░░█░░▄█▀█▀▀█▀▀▀▀▀▀█▀▀█▀█▀▀█░░░
// ░░░░▀▀▀▀░░▀▀▀░░░░░░░░▀▀▀░░▀▀░░░░

#include <bits/stdc++.h>
#include <valarray>
using namespace std;

bool dbg = 0;

clock_t start_time = clock();
#define current_time fixed<<setprecision(6)<<(ld)(clock()-start_time)/CLOCKS_PER_SEC

#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()

#define ll long long
#define ld long double
#define pii pair<int,int>
#define umap unordered_map<int, int>

#define files1 freopen("input.txt","r",stdin)
#define files2 freopen("paths.out","w",stdout)
#define files files1;files2
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0)

#define endl '\n'
#define ln(i,n) " \n"[(i) == (n) - 1]

void bad(string mes = "Impossible"){cout << mes;exit(0);}

template<typename T>
string bin(T x, int st = 2){
string ans = "";
while (x > 0){
ans += char('0' + x % st);
x /= st;
}
reverse(ans.begin(), ans.end());
return ans.empty() ? "0" : ans;
}

template<typename T>
void amax(T& x, T y) {
x = max(x, y);
}

template<typename T>
void amin(T& x, T y) {
x = min(x, y);
}

template<typename T>
T input(){
T ans = 0, m = 1;
char c = ' ';

while (!((c >= '0' && c <= '9') || c == '-')) {
c = getchar();
}

if (c == '-')
m = -1, c = getchar();
while (c >= '0' && c <= '9'){
ans = ans * 10 + (c - '0'), c = getchar();
}
return ans * m;
}

template<typename T> void read(T& a) { a = input<T>(); }
template<typename T> void read(T& a, T& b, T& c, T& d) { read(a, b), read(c, d); }

const int inf = 2e9 + 20;
const short short_inf = 3e4 + 20;
const long double eps = 1e-12;
const int maxn = 1e5 + 12, base = 1e9 + 7;
const ll llinf = 2e18 + 5;

template<typename T>
T binpow(T n, T s)
{
if (s <= 0)
return 1LL;
if (s % 2 == 0){
T b = binpow(n, s / 2);
return ( 1LL * b * b ) % base;
} else {
return (1LL* binpow(n, s - 1) * n) % base;
}
}

int f[maxn], r[maxn];
int main() {

int n;
cin >> n;

string unp;
cin >> unp;

for (int i = 0; i < n; i++) {
if (unp[i] == 'o')
f[i] = 0;
else
f[i] = 1;
}

for (r[0] = 0; r[0] < 2; r[0]++)
for (r[1] = 0; r[1] < 2; r[1]++) {
for (int i = 2; i < n; i++) {
r[i] = f[i - 1] ^ r[i - 1] ^ r[i - 2];
}
bool ok = 1;
for (int i = 0; i < n; i++) {
int l = i - 1;
if (l < 0) l += n;
int R = i + 1;
if (R >= n) R -= n;

if (f[i] != (r[i] ^ r[l] ^ r[R])) {
ok = 0;
}
}
if (ok) {
for (int i = 0; i < n; i++) {
cout << (r[i] ? "W" : "S");
}
return 0;
}
}
puts("-1");
return 0;
}```

#### Submission Info

Submission Time 2017-02-18 21:13:35+0900 D - Menagerie hloya_ygrt C++14 (GCC 5.4.1) 500 4326 Byte AC 9 ms 1408 KB

#### Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 00_example_01.txt, 00_example_02.txt, 00_example_03.txt
All 500 / 500 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 1 ms 256 KB
00_example_02.txt 1 ms 256 KB
00_example_03.txt 1 ms 256 KB
01.txt 6 ms 896 KB
02.txt 4 ms 768 KB
03.txt 1 ms 256 KB
04.txt 1 ms 256 KB
05.txt 8 ms 1280 KB
06.txt 7 ms 1280 KB
07.txt 2 ms 384 KB
08.txt 2 ms 512 KB
09.txt 1 ms 256 KB
10.txt 2 ms 512 KB
11.txt 9 ms 1308 KB
12.txt 9 ms 1408 KB
13.txt 9 ms 1308 KB