結果

問題 No.282 おもりと天秤(2)
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-02-28 05:46:41
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,066 bytes
コンパイル時間 490 ms
コンパイル使用メモリ 54,432 KB
実行使用メモリ 24,408 KB
平均クエリ数 289.04
最終ジャッジ日時 2023-09-23 09:02:53
合計ジャッジ時間 11,816 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
23,844 KB
testcase_01 AC 70 ms
24,336 KB
testcase_02 AC 32 ms
23,448 KB
testcase_03 AC 29 ms
23,652 KB
testcase_04 AC 27 ms
23,844 KB
testcase_05 AC 49 ms
24,048 KB
testcase_06 AC 88 ms
23,388 KB
testcase_07 AC 28 ms
23,556 KB
testcase_08 AC 87 ms
23,640 KB
testcase_09 AC 24 ms
23,436 KB
testcase_10 AC 2,615 ms
24,408 KB
testcase_11 TLE -
testcase_12 RE -
testcase_13 RE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>

using namespace std;

int main(){

	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	int c;
	int ans[501];
	int ansc=0;
	bool f[501];

	cin>>N;
	c=N;

	for(int i=1;i<=N;i++) f[i]=true;

	while(c>1){
		int k[501];
		int kc=0;
		for(int i=1;i<=N;i++) if(f[i]) k[kc++]=i;
		while(kc>1){
			cout<<"? ";
			int tmp[501];
			int tmpc=0;
			for(int i=0;i<kc;i++){
				cout<<k[i]<<" ";
				tmp[tmpc++]=k[i];
			}
			for(int i=0;i<N*2-kc-1;i++){
				cout<<"0 ";
				tmp[tmpc++]=0;
			}
			cout<<"0"<<endl<<flush;
			tmp[tmpc++]=0; 
			kc=0;
			for(int i=0;i<N;i++){
				string r;
				cin>>r;
				if(tmp[i*2]==0&&tmp[i*2+1]==0) continue;
				else if(tmp[i*2+1]==0) k[kc++]=tmp[i*2];
				else if(tmp[i*2]==0) k[kc++]=tmp[i*2+1];
				else if(r=="=") k[kc++]=tmp[i*2];
				else if(r=="<") k[kc++]=tmp[i*2];
				else if(r==">") k[kc++]=tmp[i*2+1];
			}
		}
		ans[ansc++]=k[0];
		f[k[0]]=false;
		c--;
	}
	cout<<"! ";
	for(int i=0;i<ansc;i++) cout<<ans[i]<<" ";
	for(int i=1;i<=N;i++){
		if(f[i]){
			cout<<i<<endl<<flush;
			break;
		}
	}
}
0