Submission #3210020
Source Code Expand
#include<iostream> #include<algorithm> #include<vector> #include<functional> #include<numeric> #include<climits> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; // それぞれ、n-1番目、0番目の動物 vector<vector<int>> ans{ vector<int>{1,1},vector<int>{1,-1},vector<int>{-1,1},vector<int>{-1,-1} }; char c; for (int i = 0; i < n; i++) { cin >> c; int k = 1; if (c == 'x') k = -1; for (int j = 0; j < 4; j++) { ans[j].push_back(k*ans[j][i] * ans[j][i + 1]); } } for (int j = 0; j < 4; j++) { if (ans[j][n] == ans[j][0] && ans[j][n + 1] == ans[j][1]) { for (int i = 1; i <= n; i++) { if (ans[j][i] == 1) { cout << 'S'; } else { cout << 'W'; } } cout << endl; return 0; } } cout << -1 << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | faogr |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 868 Byte |
Status | AC |
Exec Time | 7 ms |
Memory | 2020 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 | 1524 KB |
02.txt | AC | 4 ms | 1152 KB |
03.txt | AC | 1 ms | 384 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 7 ms | 1892 KB |
06.txt | AC | 7 ms | 1892 KB |
07.txt | AC | 2 ms | 640 KB |
08.txt | AC | 2 ms | 896 KB |
09.txt | AC | 1 ms | 384 KB |
10.txt | AC | 2 ms | 896 KB |
11.txt | AC | 7 ms | 2020 KB |
12.txt | AC | 7 ms | 2020 KB |
13.txt | AC | 7 ms | 2020 KB |