結果
問題 | No.2723 Fortune-telling by Flowers |
ユーザー | eve__fuyuki |
提出日時 | 2024-04-12 21:40:00 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,251 bytes |
コンパイル時間 | 2,609 ms |
コンパイル使用メモリ | 198,468 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-04-12 21:40:04 |
合計ジャッジ時間 | 3,300 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 14 ms
6,940 KB |
testcase_04 | WA | - |
testcase_05 | AC | 4 ms
6,940 KB |
testcase_06 | WA | - |
testcase_07 | AC | 9 ms
6,940 KB |
testcase_08 | AC | 5 ms
6,940 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int t; cin >> t; for (; t--;) { int n; string s; cin >> n >> s; char mi = '.', ma = '.'; for (char c : s) { if (c == '-') { continue; } if (mi == '.') { mi = c; } ma = c; } if (mi == ma) { cout << mi << "\n"; continue; } vector<int> cnt; for (char c : s) { if (c == '-') { if (!cnt.empty() && cnt.back() > 0) { cnt.push_back(0); } continue; } else { if (cnt.empty()) { cnt.push_back(1); } else { cnt.back()++; } } } if (cnt.size() == 1) { cout << "K\n"; continue; } cnt.front()--; cnt.back()--; int grundy = 0; for (int x : cnt) { grundy ^= x; } cout << (grundy ? "P\n" : "K\n"); } }