結果
問題 | No.2372 既視感 |
ユーザー |
|
提出日時 | 2024-03-19 21:13:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 671 bytes |
コンパイル時間 | 1,563 ms |
コンパイル使用メモリ | 174,100 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-09-30 05:41:29 |
合計ジャッジ時間 | 2,341 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:40:32: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized] 40 | cout <<ans<<endl; | ^~~ main.cpp:19:37: note: 'ans' was declared here 19 | int sum = 0,ans; | ^~~
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ deque<string> A; int n,k,q,qn,d; string qname; cin >>n>>k>>q; for (int i=0;i<q;i++){ cin >>qn; if (qn==1){ cin >>qname; A.emplace_back(qname); if(A.size()>n){ A.pop_front(); } }else{ int sum = 0,ans; bool f= true; for(int j=0;j<6;j++){ cin>>qname>>d; if(f&&find(A.begin(),A.end(),qname)!=A.end()){ sum+=min(k,d); }else if (f){ sum+=d; } if(f&&sum>60){ ans= j; f = false; } if(f) A.emplace_back(qname); } if(f)ans=6; cout <<ans<<endl; while(A.size()>n){ A.pop_front(); } } } }