結果

問題 No.2372 既視感
ユーザー Kanten4205Kanten4205
提出日時 2023-06-15 19:18:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,356 bytes
コンパイル時間 1,799 ms
コンパイル使用メモリ 179,048 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 08:37:24
合計ジャッジ時間 2,996 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 WA -
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 4 ms
4,376 KB
testcase_24 AC 3 ms
4,380 KB
testcase_25 AC 4 ms
4,376 KB
testcase_26 WA -
testcase_27 AC 4 ms
4,380 KB
testcase_28 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll N, K, Q; cin >> N >> K >> Q;
    set<string>S;
    queue<string>A;
    while (Q--) {
        int t; cin >> t;
        if (t == 1) {
            string T; cin >> T;
            if (S.find(T) == S.end()) {
                S.insert(T);
                A.push(T);
                if (S.size() > N) {
                    T = A.front(); A.pop();
                    S.erase(T);
                }
            }
        }
        else {
            string T; ll time;
            ll ans = 0, sum = 0;
            queue<string>B;
            for (int i = 0; i < 6; i++) {
                cin >> T >> time;
                if (S.find(T) == S.end()) {
                    sum += time;
                }
                else sum += min(time, K);
                if (sum <= 60) {
                    B.push(T);
                    ans++;
                }
            }
            cout << ans << endl;
            while (!B.empty()) {
                if (S.find(B.front()) == S.end()) {
                    A.push(B.front());
                    S.insert(B.front());
                    if (A.size() > N) {
                        S.erase(A.front());
                        A.pop();
                    }
                }
                B.pop();
            }
        }
    }
}
0