結果

問題 No.305 鍵(2)
ユーザー Lay_ecLay_ec
提出日時 2015-11-27 23:34:50
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,235 bytes
コンパイル時間 535 ms
コンパイル使用メモリ 77,788 KB
実行使用メモリ 35,900 KB
最終ジャッジ日時 2023-09-23 22:05:27
合計ジャッジ時間 7,139 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>

using namespace std;

int main(){

    srand(time(NULL));

    bool f[10]={};
    char  d[10]={};
    while(true){
        string out;
        for(int i=0;i<10;i++){
            if(f[i]) out=d[i]+out;
            else out=(char)('0'+rand()%10)+out;
        }
        
        cout<<out<<endl;
        cout.flush();
        
        int x;
        string res;
        cin>>x>>res;
        
        if(res[0]=='u') return 0;
        
        string test=out;
        for(int i=0;i<10;i++){
            if(f[i]) continue;
            
           string test=out;
           test[i]='0'+rand()%10;
           cout<<test<<endl;
           cout.flush();
           
           int y;
           string test_res;
           cin>>y>>test_res;
           if(test_res[0]=='u') return 0;
           
           if(x>y){
               f[i]=true; d[i]=out[i];
           }else if(x<y){
               f[i]=true; d[i]=test[i];
           }
           
        }
        
    }

    return 0;

}
0