結果

問題 No.305 鍵(2)
ユーザー kichirb3kichirb3
提出日時 2018-03-09 19:47:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 961 bytes
コンパイル時間 589 ms
コンパイル使用メモリ 70,580 KB
実行使用メモリ 24,336 KB
平均クエリ数 53.08
最終ジャッジ日時 2023-09-24 01:39:57
合計ジャッジ時間 1,940 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
24,324 KB
testcase_01 AC 22 ms
23,652 KB
testcase_02 AC 20 ms
23,376 KB
testcase_03 AC 22 ms
23,796 KB
testcase_04 AC 21 ms
23,352 KB
testcase_05 AC 23 ms
23,784 KB
testcase_06 AC 19 ms
23,520 KB
testcase_07 AC 22 ms
24,300 KB
testcase_08 AC 23 ms
23,664 KB
testcase_09 AC 21 ms
23,340 KB
testcase_10 AC 25 ms
24,336 KB
testcase_11 AC 21 ms
23,820 KB
testcase_12 AC 22 ms
24,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// No.305 鍵(2)
// https://yukicoder.me/problems/no/305
//

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


int check_keys(vector<int>& numbers);


int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    vector<int> numbers(10, 0);
    int prev_res = check_keys(numbers);

    for (auto keta = 0; keta < 10; ++keta) {
        if (prev_res == 10)
            break;
        for (auto i = 0; i < 10; ++i) {
            numbers[keta] = i;
            int res = check_keys(numbers);
            if (res > prev_res) {
                prev_res = res;
                break;
            } else if (res < prev_res) {
                numbers[keta] -= 1;
                break;
            }
        }
    }
}


int check_keys(vector<int>& numbers) {
    stringstream ss;
    for (auto n: numbers)
        cout << n;
    cout << flush << endl;

    int res;
    string s;
    cin >> res >> s;
    return res;
}
0