結果

問題 No.305 鍵(2)
ユーザー ngtkanangtkana
提出日時 2020-03-21 19:49:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 956 bytes
コンパイル時間 2,529 ms
コンパイル使用メモリ 200,340 KB
実行使用メモリ 24,420 KB
平均クエリ数 60.54
最終ジャッジ日時 2023-09-24 02:33:37
合計ジャッジ時間 3,103 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
24,036 KB
testcase_01 AC 26 ms
24,252 KB
testcase_02 AC 25 ms
24,420 KB
testcase_03 AC 25 ms
23,688 KB
testcase_04 AC 25 ms
24,312 KB
testcase_05 AC 26 ms
24,012 KB
testcase_06 AC 23 ms
23,676 KB
testcase_07 AC 25 ms
24,024 KB
testcase_08 AC 24 ms
23,544 KB
testcase_09 AC 24 ms
24,024 KB
testcase_10 AC 24 ms
23,652 KB
testcase_11 AC 24 ms
23,388 KB
testcase_12 AC 25 ms
23,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using lint=long long;
#define AUTO 0
#if AUTO
    std::string secret="0011223304";
#endif
lint query(std::string s){
    std::cout<<s<<std::endl;
    lint x=0;
#if AUTO
    for(lint i=0;i<10;i++){
        x+=s.at(i)==secret.at(i);
    }
#else
    std::cin>>x>>s;
#endif
    if(s.front()=='u')exit(0);
    return x;
}
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    std::string ans=std::string(10,'$');
    std::string basic(10,'0');
    lint basic_ans=query(basic);
    for(lint i=0;i<10;i++){
        for(lint j=1;j<=10;j++){
            if(j==10){
                ans.at(i)='0';
                break;
            }
            basic.at(i)='0'+j;
            if(basic_ans<query(basic)){
                ans.at(i)='0'+j;
                break;
            }
        }
        basic.at(i)='0';
    }
    std::cout<<ans<<std::endl;
}
0