結果

問題 No.305 鍵(2)
ユーザー ミドリムシミドリムシ
提出日時 2018-03-07 16:58:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 737 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 69,464 KB
実行使用メモリ 24,348 KB
平均クエリ数 69.85
最終ジャッジ日時 2023-09-24 01:40:02
合計ジャッジ時間 1,687 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,288 KB
testcase_01 AC 21 ms
24,036 KB
testcase_02 AC 23 ms
23,352 KB
testcase_03 AC 22 ms
24,348 KB
testcase_04 AC 22 ms
23,664 KB
testcase_05 AC 24 ms
23,640 KB
testcase_06 AC 20 ms
23,964 KB
testcase_07 AC 25 ms
23,376 KB
testcase_08 AC 23 ms
24,060 KB
testcase_09 AC 24 ms
24,036 KB
testcase_10 AC 25 ms
24,348 KB
testcase_11 AC 22 ms
23,412 KB
testcase_12 AC 22 ms
23,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

string zero = "0000000000";

int challenge(int change_point, int change_number){
    zero[change_point] = change_number + '0';
    cout << zero << endl;
    zero = "0000000000";
    int reply;
    string if_locked;
    cin >> reply >> if_locked;
    if(reply == 10){
        exit(0);
    }else{
        return reply;
    }
}

int main(){
    string ans = "          ";
    for(int i = 0; i < 10; i++){
        int normal = min(challenge(i, 0), challenge(i, 1));
        for(int j = 0; j < 10; j++){
            if(challenge(i, j) != normal){
                ans[i] = j + '0';
                break;
            }
        }
    }
    cout << ans << endl;
}
0