結果
| 問題 |
No.2372 既視感
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-15 19:18:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,356 bytes |
| コンパイル時間 | 1,854 ms |
| コンパイル使用メモリ | 180,828 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 15:59:39 |
| 合計ジャッジ時間 | 2,785 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 5 |
ソースコード
#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();
}
}
}
}