結果

問題 No.2372 既視感
ユーザー 259-Momone259-Momone
提出日時 2024-03-19 20:33:06
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,292 bytes
コンパイル時間 4,150 ms
コンパイル使用メモリ 334,196 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-19 20:33:14
合計ジャッジ時間 6,341 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/extc++.h>

int main() {
    using namespace std;
    unsigned N, K, Q;
    cin >> N >> K >> Q;

    map<string, unsigned> counter;
    deque<string> viewed(N);
    counter[""] = N;

    for (unsigned i{}; i < Q; ++i) {
        unsigned type;
        cin >> type;
        if (type == 1) {
            string S;
            cin >> S;
            ++counter[S];
            viewed.emplace_back(S);
            if (!--counter[viewed.front()])
                counter.erase(viewed.front());
            viewed.pop_front();
        } else {
            array<unsigned, 6> v{};
            for (unsigned j{}; j < 6; ++j) {
                string S;
                cin >> S;
                unsigned time;
                cin >> time;
                if (counter.contains(S))
                    v[j] = min(time, K);
                else
                    v[j] = time;
            }
            unsigned ans{};
            for (unsigned j{}; j < 64; ++j) {
                unsigned time{};
                for (unsigned k{}; k < 6; ++k)
                    if (1 & (j >> k))
                        time += v[k];
                if (time <= 60)
                    ans = max<unsigned>(ans, popcount(j));
            }
            cout << ans << endl;
        }
    }
    return 0;
}
0