結果
問題 | No.305 鍵(2) |
ユーザー | imulan |
提出日時 | 2016-02-08 20:29:13 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 1,099 bytes |
コンパイル時間 | 1,130 ms |
コンパイル使用メモリ | 145,700 KB |
実行使用メモリ | 24,324 KB |
平均クエリ数 | 92.62 |
最終ジャッジ日時 | 2023-09-23 23:08:56 |
合計ジャッジ時間 | 2,284 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 26 ms
24,036 KB |
testcase_01 | AC | 22 ms
24,024 KB |
testcase_02 | AC | 22 ms
24,024 KB |
testcase_03 | AC | 22 ms
23,352 KB |
testcase_04 | AC | 23 ms
24,324 KB |
testcase_05 | AC | 23 ms
23,352 KB |
testcase_06 | AC | 19 ms
24,024 KB |
testcase_07 | AC | 25 ms
23,652 KB |
testcase_08 | AC | 24 ms
23,388 KB |
testcase_09 | AC | 27 ms
23,808 KB |
testcase_10 | AC | 26 ms
23,616 KB |
testcase_11 | AC | 23 ms
23,412 KB |
testcase_12 | AC | 23 ms
24,000 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(i=0;i<n;++i) #define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++) #define mp make_pair #define pb push_back #define fi first #define sc second int main(int argc, char const *argv[]) { int i,j; bool found=false; while(1){ int x; string lock; string ans="0000000000"; rep(i,10){//左からi番目の桁について int ct[10]={0}; rep(j,10){ string r="0000000000"; r[i]=j+'0'; cout << r <<endl; cout <<flush; cin >>x >>lock; if(x==10){ found=true; break; } else{ ct[j]=x; } } if(found)break; else{ int m=0; int r=-1; rep(j,10){ if(m<ct[j]){ m=ct[j]; r=j; } } ans[i]='0'+r; } } if(found)break; cout << ans <<endl; cout <<flush; cin >>x >>lock; if(x==10){ found=true; break; } } return 0; }