結果
問題 | No.2723 Fortune-telling by Flowers |
ユーザー | binap |
提出日時 | 2024-04-12 23:04:49 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 170 ms / 2,000 ms |
コード長 | 1,543 bytes |
コンパイル時間 | 2,223 ms |
コンパイル使用メモリ | 195,164 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-04-12 23:04:53 |
合計ジャッジ時間 | 3,815 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 6 ms
6,940 KB |
testcase_02 | AC | 33 ms
6,940 KB |
testcase_03 | AC | 154 ms
6,944 KB |
testcase_04 | AC | 170 ms
6,940 KB |
testcase_05 | AC | 13 ms
6,940 KB |
testcase_06 | AC | 14 ms
6,940 KB |
testcase_07 | AC | 16 ms
6,940 KB |
testcase_08 | AC | 17 ms
6,944 KB |
testcase_09 | AC | 49 ms
6,940 KB |
testcase_10 | AC | 17 ms
6,944 KB |
testcase_11 | AC | 15 ms
6,944 KB |
testcase_12 | AC | 15 ms
6,940 KB |
testcase_13 | AC | 16 ms
6,940 KB |
ソースコード
#include<bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;i++) using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<long long> vl; typedef vector<vector<int>> vvi; typedef vector<vector<long long>> vvl; typedef pair<int,int> P; typedef long double ld; template<typename T>istream& operator>>(istream& is, vector<T>& v){int n = v.size(); assert(n > 0); rep(i, n) is >> v[i]; return is;} template<typename U, typename T> ostream& operator<<(ostream& os, const pair<U, T>& p){os << p.first << ' ' << p.second; return os;} template<typename T>ostream& operator<<(ostream& os, const vector<T>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : " "); return os;} template <typename T>ostream& operator<<(ostream& os, const vector<vector<T>>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : ""); return os;} template<typename T> void chmin(T& a, T b){a = min(a, b);} template<typename T> void chmax(T& a, T b){a = max(a, b);} int solve(){ int n; cin >> n; int k = 0, p = 0; string s; { string _s; cin >> _s; s += '-'; s += _s; s += '-'; n += 2; } char first = '?'; char last = '?'; rep(i, n){ if(s[i] == '-'){ if(first == '?') continue; else{ if(first == 'P' and last == 'P') p++; if(first == 'K' and last == 'K') k++; first = '?'; last = '?'; } }else{ if(first == '?') first = s[i]; last = s[i]; } } if(k >= p) cout << "K\n"; else cout << "P\n"; return 0; } int main(){ int t; cin >> t; rep(_, t) solve(); return 0; }