結果
問題 |
No.282 おもりと天秤(2)
|
ユーザー |
![]() |
提出日時 | 2016-02-28 05:46:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,066 bytes |
コンパイル時間 | 666 ms |
コンパイル使用メモリ | 56,444 KB |
実行使用メモリ | 32,944 KB |
平均クエリ数 | 123.42 |
最終ジャッジ日時 | 2024-07-16 08:43:09 |
合計ジャッジ時間 | 12,017 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 RE * 4 TLE * 2 -- * 8 |
ソースコード
#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; } } }