結果
問題 |
No.2372 既視感
|
ユーザー |
|
提出日時 | 2024-03-19 20:33:06 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,292 bytes |
コンパイル時間 | 5,677 ms |
コンパイル使用メモリ | 332,744 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-09-30 05:38:40 |
合計ジャッジ時間 | 4,452 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 WA * 23 |
ソースコード
#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; }