Submission #1116370
Source Code Expand
#include <algorithm> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <vector> #define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i)) #define rep(i,n) FOR(i,0,n) #define pb push_back #define all(v) begin(v), end(v) #define debug(x) cerr<< #x <<": "<<x<<endl #define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vector<int> > vvi; typedef vector<ll> vll; typedef vector<vector<ll> > vvll; template<class T> using vv=vector<vector< T > >; int main() { int n; cin >> n; string s_; cin >> s_; vi s(n, 0); rep (i, n) { if (s_[i] == 'x') { s[i] = 1; } } vi a(n, 0); rep (i, 4) { a[0] = i/2; a[1] = (i&1); FOR (j, 2, n) { a[j] = a[j-2] ^ ((s[j-1] + a[j-1]) % 2); } if ((((a[n-2] ^ a[0]) ^ a[n-1]) == s[n-1]) && (((a[n-1] ^ a[1]) ^ a[0]) == s[0])) { rep (i, n) { char tmp; if (a[i] == 0) { tmp = 'S'; } else { tmp = 'W'; } printf("%c", tmp); } printf("\n"); return 0; } } printf("-1\n"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | tspcx |
Language | C++14 (Clang 3.8.0) |
Score | 500 |
Code Size | 1541 Byte |
Status | AC |
Exec Time | 9 ms |
Memory | 1344 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 | 6 ms | 1024 KB |
02.txt | AC | 4 ms | 768 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 8 ms | 1280 KB |
06.txt | AC | 7 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 | 2 ms | 512 KB |
11.txt | AC | 9 ms | 1344 KB |
12.txt | AC | 9 ms | 1344 KB |
13.txt | AC | 9 ms | 1344 KB |