Submission #1115347
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define F first #define S second #define fo(i, n) for(int i = 1; i <= n; ++i) #define rep(i, a, b) for(int (i) = (a); (i) < (b); ++(i)) typedef long long ll; typedef pair <int, int> pii; typedef pair <ll, ll> pll; const int N = 200200; const int mod = 1e9 + 7; const ll INF = 1e18; int n; string s; int a[N], b[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin>>n; cin>>s; for(int i=0;i<2;++i) for(int j=0;j<2;++j) { a[0]=i,a[1]=j; b[0]=i,b[1]=j; for(int k=1;k<n;++k) { if(a[k]==1) { if(s[k]=='o') a[(k+1)%n]=a[k-1]^1; else a[(k+1)%n]=a[k-1]; } else { if(s[k]=='o') a[(k+1)%n]=a[k-1]; else a[(k+1)%n]=a[k-1]^1; } } if(b[0]!=a[0]) continue; for(int k=0;k<n;++k) if(!a[k]) cout<<'S'; else cout<<'W'; return 0; } cout<<-1; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | Speedster |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1021 Byte |
Status | WA |
Exec Time | 6 ms |
Memory | 976 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 4 ms | 768 KB |
02.txt | AC | 3 ms | 640 KB |
03.txt | AC | 3 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | WA | 6 ms | 896 KB |
06.txt | AC | 5 ms | 896 KB |
07.txt | WA | 2 ms | 384 KB |
08.txt | AC | 2 ms | 384 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | WA | 2 ms | 384 KB |
11.txt | WA | 5 ms | 976 KB |
12.txt | WA | 5 ms | 976 KB |
13.txt | WA | 6 ms | 976 KB |