Submission #3616761
Source Code Expand
#include <cstdio> #include <cstdint> #include <iostream> #include <iomanip> #include <string> #include <queue> #include <stack> #include <vector> #include <set> #include <map> #include <unordered_map> #include <algorithm> #include <utility> #include <cmath> #include <climits> #include <bitset> #define ll long long int #define pb push_back #define mk make_pair #define pq priority_queue using namespace std; typedef pair<int, int> P; typedef pair<ll, int> Pl; typedef pair<ll, ll> Pll; const int inf = 1e9; const ll linf = 1LL << 50; const double EPS = 1e-10; bool is_sheep0[4] = {true, true, false, false}; bool is_sheep1[4] = {true, false, true, false}; vector<bool> sheep; int n; string s; bool check(){ if(((sheep[n - 1] && s[n - 1] == 'o') || (!sheep[n - 1] && s[n - 1] == 'x')) && sheep[n - 2] != sheep[0])return false; if(((sheep[n - 1] && s[n - 1] == 'x') || (!sheep[n - 1] && s[n - 1] == 'o')) && sheep[n - 2] == sheep[0])return false; if(((sheep[0] && s[0] == 'o') || (!sheep[0] && s[0] == 'x')) && sheep[n - 1] != sheep[1])return false; if(((sheep[0] && s[0] == 'x') || (!sheep[0] && s[0] == 'o')) && sheep[n - 1] == sheep[1])return false; return true; } void dump() { for(int i = 0; i < n; i++){ if(sheep[i])cout << 'S'; else cout << 'W'; } cout << endl; } int main(int argc, char const* argv[]) { cin >> n; cin >> s; for(int i = 0; i < 4; i++){ sheep = vector<bool>(n, false); sheep[0] = is_sheep0[0]; sheep[1] = is_sheep1[0]; for(int j = 1; j < n - 1; j++){ if((sheep[j] && s[j] == 'o') || (!sheep[j] && s[j] == 'x')){ sheep[j + 1] = sheep[j - 1]; }else{ sheep[j + 1] = !sheep[j - 1]; } } if(check()){ dump(); return 0; } } cout << - 1 << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | fumiphys |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1862 Byte |
Status | WA |
Exec Time | 8 ms |
Memory | 512 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 | 5 ms | 384 KB |
02.txt | AC | 5 ms | 384 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | WA | 1 ms | 256 KB |
05.txt | WA | 7 ms | 512 KB |
06.txt | AC | 8 ms | 512 KB |
07.txt | WA | 2 ms | 256 KB |
08.txt | WA | 2 ms | 256 KB |
09.txt | AC | 2 ms | 256 KB |
10.txt | AC | 2 ms | 256 KB |
11.txt | WA | 7 ms | 512 KB |
12.txt | WA | 7 ms | 512 KB |
13.txt | WA | 7 ms | 512 KB |