結果

問題 No.305 鍵(2)
ユーザー rickythetarickytheta
提出日時 2015-11-28 21:02:30
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 1,146 bytes
コンパイル時間 3,694 ms
コンパイル使用メモリ 146,188 KB
実行使用メモリ 24,456 KB
平均クエリ数 52.15
最終ジャッジ日時 2023-09-23 22:11:10
合計ジャッジ時間 2,554 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
23,472 KB
testcase_01 AC 28 ms
23,280 KB
testcase_02 AC 26 ms
23,580 KB
testcase_03 AC 27 ms
23,664 KB
testcase_04 AC 27 ms
23,448 KB
testcase_05 AC 28 ms
24,456 KB
testcase_06 AC 25 ms
23,472 KB
testcase_07 AC 28 ms
23,484 KB
testcase_08 AC 28 ms
24,096 KB
testcase_09 AC 27 ms
23,448 KB
testcase_10 AC 27 ms
23,604 KB
testcase_11 AC 28 ms
24,048 KB
testcase_12 AC 27 ms
24,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  string fin = "";
  string cand = "";
  bool ok = false;
  REP(i,10){
    int cl = -1;
    REP(j,10){
      string s = fin;
      s += (j+'0');
      REP(_,10-1-i) s += "0";
      cout << s << endl;
      int x;
      string t;
      cin >> x >> t;
      if(x==10){
        ok = true;
        fin += (j+'0');
        break;
      }
      if(cl == -1){
        cl = x;
        cand = fin;
        cand += (j+'0');
      }else if(x > cl){
        cl = x;
        fin += (j+'0');
        break;
      }else if(x < cl){
        fin = cand;
        break;
      }
    }
    if(ok)break;
  }
  return 0;
}
0