結果
問題 | No.2372 既視感 |
ユーザー | ぷら |
提出日時 | 2023-07-07 22:17:04 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 931 bytes |
コンパイル時間 | 2,305 ms |
コンパイル使用メモリ | 210,932 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-21 18:22:19 |
合計ジャッジ時間 | 3,366 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N,K,Q; cin >> N >> K >> Q; vector<string>S; while(Q--) { int f; cin >> f; if(f == 1) { string s; cin >> s; S.push_back(s); } else { set<string>st; for(int i = max(0,(int)(S.size())-N); i < S.size(); i++) { st.insert(S[i]); } int cnt = 0,sum = 0; for(int i = 0; i < 6; i++) { string t; int d; cin >> t >> d; if(st.count(t)) { d = min(d,K); } sum += d; if(sum <= 60) { cnt++; S.push_back(t); } } cout << cnt << "\n"; } } }