Submission #1115343
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < int(n); ++i) #define REPE(i, a, b) for (int i = (a); i <= int(b); ++i) #define SZ(x) ((int)(x).size()) #define ALL(x) x.begin(), x.end() #define PB push_back #define EB emplace_back using LL = long long; using PII = pair<int, int>; #define F first #define S second int n; string s; int a[100010]; void solve(int aa, int bb) { a[0] = aa, a[1] = bb; for (int i = 2; i < n; ++i) { int t = s[i - 1] == 'o' ? 0 : 1; a[i] = a[i-1] ^ a[i-2] ^ t; } REP(i, n) { int sum = a[i] ^ a[i == 0 ? n - 1 : i - 1] ^ a[i == n - 1 ? 0 : i + 1]; int e = s[i] == 'o' ? 0 : 1; if (sum != e) return; } REP(i, n) putchar(a[i] ? 'W' : 'S'); puts(""); exit(0); } int main() { cin >> n >> s; REP(i, 2) REP(j, 2) solve(i, j); puts("-1"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | cchao |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 896 Byte |
Status | AC |
Exec Time | 7 ms |
Memory | 896 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 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 | AC | 5 ms | 640 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 | 896 KB |
06.txt | AC | 5 ms | 896 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 | 7 ms | 896 KB |
12.txt | AC | 7 ms | 896 KB |
13.txt | AC | 7 ms | 896 KB |