結果
| 問題 | No.2372 既視感 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-03-19 21:13:06 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 726 bytes | 
| コンパイル時間 | 1,633 ms | 
| コンパイル使用メモリ | 174,472 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-09-30 05:41:27 | 
| 合計ジャッジ時間 | 2,496 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 2 | 
| other | WA * 26 | 
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:41:32: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   41 |                         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()){
					cout <<"A" <<endl;
					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){
				cout <<A.size()<<endl;
				A.pop_front();
			}
		}
		
		
		
	}
}
            
            
            
        