結果

問題 No.3496 協力カード当て
コンテスト
ユーザー askr58
提出日時 2026-04-14 21:44:03
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
RE  
実行時間 -
コード長 1,585 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,320 ms
コンパイル使用メモリ 340,140 KB
実行使用メモリ 30,320 KB
スコア 0
平均クエリ数 7.00
最終ジャッジ日時 2026-04-14 23:50:46
合計ジャッジ時間 12,872 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int id,n,m;
	cin>>id>>n>>m;
	vector<int> cnt(m+1);
	for(int i=0;i<n;i++){
		int t;
		cin>>t;
		cnt[t]++;
	}
	vector<int> cnt2(m+1);
	vector<int> res(m+1,-1);
	for(int i=m-1;i>=1;i--){
		if(id==1){
			string s;
			cin>>s;
			cout<<"ASK "<<cnt[i]+1<<endl;
			cin>>s;
			cout<<s<<endl;
			int x,k;
			cin>>x>>k;
			res[x]=k;
			cin>>s;
			cin>>s;
			cin>>x>>k;
			res[x]=k;
			cnt2[i]=x;
		}else{
			string s;
			cin>>s;
			cin>>s;
			int x,k;
			cin>>x>>k;
			res[x]=k;
			cnt2[i]=x;
			cin>>s;
			cout<<"ASK "<<cnt[i]+1<<endl;
			cin>>s;
			cin>>x>>k;
			res[x]=k;
		}
	}
	int ptr=m;
	auto answer=[&]()->void{
		vector<int> vec;
		for(int i=1;i<=m;i++){
			for(int j=0;j<res[i]-cnt[i]-cnt2[i];j++)vec.push_back(i);
		}
		assert(vec.size()==n);
		cout<<"GUESS";
		for(int i=0;i<n;i++)cout<<" "<<vec[i];
		cout<<endl;

	};
	while(ptr>0){
		if(id==1){
			string s;
			cin>>s;
			while(ptr>0&&res[ptr]!=-1)ptr--;
			if(ptr>0){
				cout<<"ASK "<<ptr<<endl;
				cin>>s;
				int x,k;
				cin>>x>>k;
				res[x]=k;
			}else{
				answer();
				return 0;
			}
			cin>>s;
			cin>>s;
			if(s=="COUNT"){
				int x,k;
				cin>>x>>k;
				res[x]=k;
			}
		}else{
			string s;
			cin>>s;
			cin>>s;
			if(s=="COUNT"){
				int x,k;
				cin>>x>>k;
				res[x]=k;
			}
			cin>>s;
			while(ptr>0&&res[ptr]!=-1)ptr--;
			if(ptr>0){
				cout<<"ASK "<<ptr<<endl;
				cin>>s;
				int x,k;
				cin>>x>>k;
				res[x]=k;
			}else{
				answer();
				return 0;
			}
		}
	}
}
				


		
			

0