結果
問題 | No.2372 既視感 |
ユーザー |
![]() |
提出日時 | 2024-04-15 12:58:29 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 1,197 bytes |
コンパイル時間 | 2,561 ms |
コンパイル使用メモリ | 212,048 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-05 09:16:40 |
合計ジャッジ時間 | 2,770 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h>using namespace std;void fast_io() {ios_base::sync_with_stdio(false);cin.tie(nullptr);}int main() {int n, k, q;cin >> n >> k >> q;multiset<string> vis;deque<string> dq;auto add = [&](string s) {dq.push_back(s);vis.insert(s);while (dq.size() > n) {vis.erase(vis.find(dq.front()));dq.pop_front();}};for (; q--;) {int type;cin >> type;if (type == 1) {string s;cin >> s;add(s);} else {vector<string> t(6);vector<int> d(6);for (int i = 0; i < 6; i++) {cin >> t[i] >> d[i];if (vis.find(t[i]) != vis.end()) {d[i] = min(d[i], k);}}int ans = 0, cur = 0;while (ans < 6) {if (cur + d[ans] <= 60) {cur += d[ans];add(t[ans]);ans++;} else {break;}}cout << ans << "\n";}}}