結果
問題 | No.305 鍵(2) |
ユーザー | Lay_ec |
提出日時 | 2015-11-27 23:53:18 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 1,516 bytes |
コンパイル時間 | 569 ms |
コンパイル使用メモリ | 77,232 KB |
実行使用メモリ | 24,384 KB |
平均クエリ数 | 68.08 |
最終ジャッジ日時 | 2023-09-23 22:06:32 |
合計ジャッジ時間 | 1,973 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
24,036 KB |
testcase_01 | AC | 28 ms
23,544 KB |
testcase_02 | AC | 27 ms
23,424 KB |
testcase_03 | AC | 27 ms
23,676 KB |
testcase_04 | AC | 26 ms
24,276 KB |
testcase_05 | AC | 26 ms
24,024 KB |
testcase_06 | AC | 25 ms
23,688 KB |
testcase_07 | AC | 27 ms
23,412 KB |
testcase_08 | AC | 28 ms
23,640 KB |
testcase_09 | AC | 26 ms
23,652 KB |
testcase_10 | AC | 26 ms
24,012 KB |
testcase_11 | AC | 26 ms
23,424 KB |
testcase_12 | AC | 26 ms
24,384 KB |
ソースコード
#include <iostream> #include <string> #include <vector> #include <cmath> #include <algorithm> #include <cstdlib> #include <ctime> #include <cstdio> #include <functional> #include <set> #include <sstream> #include <map> #include <queue> #include <stack> using namespace std; const int N=10; int main(){ srand(time(NULL)); bool f[N]={}; char d[N]={}; while(true){ // for(int i=0;i<N;i++) printf("(%d,%c) ",f[i],d[i]); // cout<<endl; //cout<<"new"<<endl; string out; for(int i=0;i<N;i++){ if(f[i]) out+=d[i]; else out+=(char)('0'+rand()%10); } cout<<out<<endl; cout.flush(); int x; string res; cin>>x>>res; if(res[0]=='u') return 0; string test=out; for(int i=0;i<N;i++){ //if(f[i]){cout<<"digit"<<i<<" is ok "<<endl; continue;} if(f[i]) continue; string test=out; test[i]='0'+rand()%10; cout<<test<<endl; cout.flush(); int y; string test_res; cin>>y>>test_res; //cout<<"x="<<x<<" y="<<y<<endl; if(test_res[0]=='u') return 0; if(x>y){ f[i]=true; d[i]=out[i]; }else if(x<y){ f[i]=true; d[i]=test[i]; } } //cout<<endl; } return 0; }