Submission #3423023
Source Code Expand
#include<bits/stdc++.h> using namespace std; using ll = long long int; using vi = vector<int>; using vll = vector<long long int>; using vii = vector<vi>; using pii = pair<int, int>; #define REP(i,n) for(int (i)=0;(i)<(n);(i)++) #define FOR(i, a, b) for(int (i) = a; (i) < (b);(i)++) #define MAX(a, b) ((a > b) ? a : b) #define MIN(a, b) ((a > b) ? b : a) int gcd(int a,int b){return b?gcd(b,a%b):a;} int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; const int QUA = 1e9 + 7; int n; vector<bool> A; string s; void prnt(){ for(int i = 0; i < n;i++){ printf("%c", (A[i] ? 'S' : 'W')); } puts(""); } bool prgct(bool a, bool b){ A[0] = a; A[1] = b; for(int i = 1; i < n - 1;i++){ A[i + 1] = ((s[i] == 'o') == A[i]) == A[i - 1]; } bool tmp = ((s[n - 1] == 'o') == A[n-1]) == A[n - 2]; if(A[0] == tmp){ if(A[1] == (((s[0] == 'o') == A[0]) == A[n - 1])){ prnt(); return false; } } return true; } int main(){ cin >> n >> s; A.resize(n); bool flag = true; if(flag){ flag = prgct(true, true); } if(flag){ flag = prgct(true, false); } if(flag){ flag = prgct(false, true); } if(flag){ flag = prgct(false, false); } if(flag){ puts("-1"); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | arounderstand |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1305 Byte |
Status | AC |
Exec Time | 8 ms |
Memory | 512 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 | 384 KB |
02.txt | AC | 3 ms | 384 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 7 ms | 512 KB |
06.txt | AC | 5 ms | 512 KB |
07.txt | AC | 2 ms | 256 KB |
08.txt | AC | 2 ms | 256 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 2 ms | 256 KB |
11.txt | AC | 8 ms | 512 KB |
12.txt | AC | 8 ms | 512 KB |
13.txt | AC | 7 ms | 512 KB |