結果

問題 No.305 鍵(2)
ユーザー Konton7Konton7
提出日時 2020-01-14 23:16:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 747 bytes
コンパイル時間 1,941 ms
コンパイル使用メモリ 198,800 KB
実行使用メモリ 24,348 KB
平均クエリ数 92.62
最終ジャッジ日時 2023-09-24 02:23:52
合計ジャッジ時間 3,351 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
23,532 KB
testcase_01 AC 27 ms
23,532 KB
testcase_02 AC 27 ms
24,348 KB
testcase_03 AC 27 ms
24,036 KB
testcase_04 AC 27 ms
24,252 KB
testcase_05 AC 28 ms
23,436 KB
testcase_06 AC 24 ms
23,532 KB
testcase_07 AC 28 ms
23,412 KB
testcase_08 AC 28 ms
24,036 KB
testcase_09 AC 28 ms
23,700 KB
testcase_10 AC 27 ms
24,048 KB
testcase_11 AC 27 ms
23,568 KB
testcase_12 AC 29 ms
24,252 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:28:28: 警告: ‘collect_max’ may be used uninitialized [-Wmaybe-uninitialized]
   28 |         ans += collect_max + '0';
      |                ~~~~~~~~~~~~^~~~~
main.cpp:9:18: 備考: ‘collect_max’ はここで定義されています
    9 |     int collect, collect_max, ret_collect;
      |                  ^~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;



int main(){
    int collect, collect_max, ret_collect;
    int const digit = 10;
    string s, ans, ret_string;
    string const s0 = "0000000000";
    for (int i = 0; i < digit; i++){
        s = s0;
        collect = -1;
        for (int j = 0; j < digit; j++){
            cout << s << endl;
            cin >> ret_collect >> ret_string;
            if (ret_string == "unlocked")
                return 0;
            else{
                if (ret_collect > collect)
                    collect_max = j;
                collect = ret_collect;
            }
            s[i]++;
        }
        ans += collect_max + '0';
    }
    
    cout << ans << endl;
    return 0;
}
0