Submission #3224621
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i,s,n) for(int i = (s);i<(n);i++) #define repe(i,s,n) for(int i = (s);i<=(n);i++) #define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--) #define all(v) (v).begin(),(v).end() #define pb push_back #define fi first #define se second typedef long long ll; typedef pair<int,int>pint; typedef vector<int>vint; const ll MOD=1000000007,INF=1e18; int dy[]={1,0,-1,0}; int dx[]={0,1,0,-1}; int n,r[100010]; string s; signed main(){ bool can=false; cin>>n>>s; rep(i,0,4){ bool b[n]; b[0]=((i&1)!=0); b[1]=((i&2)!=0); rep(j,2,n)b[j]=b[j-1]^b[j-2]^(s[j-1]=='o'); if((s[0]=='o')^b[0]^b[n-1]^b[1])continue; if((s[n-1]=='o')^b[n-1]^b[n-2]^b[0])continue; rep(j,0,n)cout<<(b[j]?'S':'W'); cout<<endl; return 0; } cout<<-1<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | chocopuu |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1000 Byte |
Status | AC |
Exec Time | 8 ms |
Memory | 640 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 | 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 | AC | 7 ms | 640 KB |
06.txt | AC | 7 ms | 640 KB |
07.txt | AC | 2 ms | 256 KB |
08.txt | AC | 2 ms | 384 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 2 ms | 256 KB |
11.txt | AC | 7 ms | 640 KB |
12.txt | AC | 7 ms | 640 KB |
13.txt | AC | 8 ms | 640 KB |