結果

問題 No.305 鍵(2)
ユーザー tottoripapertottoripaper
提出日時 2018-01-07 02:13:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 850 bytes
コンパイル時間 429 ms
コンパイル使用メモリ 66,360 KB
実行使用メモリ 24,288 KB
平均クエリ数 143.00
最終ジャッジ日時 2023-09-24 01:37:24
合計ジャッジ時間 1,663 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,520 KB
testcase_01 AC 30 ms
23,568 KB
testcase_02 AC 24 ms
23,580 KB
testcase_03 AC 24 ms
23,568 KB
testcase_04 AC 30 ms
23,364 KB
testcase_05 AC 27 ms
23,316 KB
testcase_06 AC 21 ms
23,580 KB
testcase_07 AC 26 ms
23,652 KB
testcase_08 AC 25 ms
23,940 KB
testcase_09 AC 25 ms
24,276 KB
testcase_10 AC 25 ms
23,964 KB
testcase_11 AC 25 ms
24,288 KB
testcase_12 AC 26 ms
23,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <tuple>
using namespace std;

char S[100];

int ask(){
    std::cout << S << std::endl;

    int N;
    std::string T;
    std::cin >> N >> T;

    if(N == 10){exit(0);}
    
    return N;
}

int main(){
    for(int i=0;i<10;++i){
        S[i] = '0';
    }
    
    for(int i=0;i<10;++i){
        int x = -1, n = 100;
        for(int j=0;j<10;++j){
            for(int k=i+1;k<10;++k){
                S[k] = '0' + j;
            }

            int m = ask();
            if(m < n){
                x = j;
                n = m;
            }
        }

        for(int j=i+1;j<10;++j){
            S[j] = '0' + x;
        }

        for(int j=0;j<10;++j){
            S[i] = '0' + j;
            if(ask() == i + 1){
                break;
            }
        }
    }
}
0