結果

問題 No.282 おもりと天秤(2)
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-02-28 05:35:26
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,123 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 62,324 KB
実行使用メモリ 35,428 KB
平均クエリ数 123.42
最終ジャッジ日時 2023-09-23 09:04:09
合計ジャッジ時間 11,438 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,568 KB
testcase_01 AC 77 ms
23,856 KB
testcase_02 AC 34 ms
24,096 KB
testcase_03 AC 30 ms
24,060 KB
testcase_04 AC 28 ms
23,556 KB
testcase_05 AC 51 ms
23,652 KB
testcase_06 AC 90 ms
23,424 KB
testcase_07 AC 28 ms
23,664 KB
testcase_08 AC 89 ms
23,580 KB
testcase_09 AC 24 ms
24,060 KB
testcase_10 AC 2,767 ms
24,048 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main(){

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

	int N;
	int c;
	vector<int> ans;
	bool f[501];

	cin>>N;
	c=N;

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

	while(c>1){
		vector<int> k;
		for(int i=1;i<=N;i++) if(f[i]) k.push_back(i);
		while(k.size()>1){
			cout<<"? ";
			vector<int> tmp;
			for(int i=0;i<k.size();i++){
				cout<<k[i]<<" ";
				tmp.push_back(k[i]);
			}
			for(int i=0;i<N*2-k.size()-1;i++){
				cout<<"0 ";
				tmp.push_back(0);
			}
			cout<<"0"<<endl<<flush;
			tmp.push_back(0); 
			k.clear();
			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.push_back(tmp[i*2]);
				else if(tmp[i*2]==0) k.push_back(tmp[i*2+1]);
				else if(r=="=") k.push_back(tmp[i*2]);
				else if(r=="<") k.push_back(tmp[i*2]);
				else if(r==">") k.push_back(tmp[i*2+1]);
			}
		}
		ans.push_back(k[0]);
		f[k[0]]=false;
		c--;
	}
	cout<<"! ";
	for(int i=0;i<ans.size();i++) cout<<ans[i]<<" ";
	for(int i=1;i<=N;i++){
		if(f[i]){
			cout<<i<<endl<<flush;
			break;
		}
	}
}
0