結果
問題 | No.2372 既視感 |
ユーザー |
![]() |
提出日時 | 2023-07-07 21:37:23 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 776 bytes |
コンパイル時間 | 2,039 ms |
コンパイル使用メモリ | 206,648 KB |
最終ジャッジ日時 | 2025-02-15 06:55:35 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int n,k,q;cin>>n>>k>>q;multiset<string> st;deque<string> dq;auto Insert=[&](string str) {if (dq.size()>=n) {string fr=dq.front();dq.pop_front();st.erase(st.find(fr));}dq.push_back(str);st.insert(str);};while (q--) {int t;cin>>t;if (t==1) {string s;cin>>s;Insert(s);}else {int time=0;vector<string> ins;for (int i=0;i<6;i++) {string s;int d;cin>>s>>d;time+=(st.count(s)?min(k,d):d);if (time<=60) {ins.push_back(s);}}cout<<ins.size()<<endl;for (string str:ins) {Insert(str);}}}}