結果
| 問題 | No.2372 既視感 | 
| コンテスト | |
| ユーザー |  ぷら | 
| 提出日時 | 2023-07-07 22:17:04 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 40 ms / 2,000 ms | 
| コード長 | 931 bytes | 
| コンパイル時間 | 2,103 ms | 
| コンパイル使用メモリ | 201,996 KB | 
| 最終ジャッジ日時 | 2025-02-15 07:39:25 | 
| ジャッジサーバーID (参考情報) | judge3 / 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";
        }
    }
}
            
            
            
        