結果

問題 No.305 鍵(2)
ユーザー koba-e964koba-e964
提出日時 2015-12-01 12:11:55
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 1,083 bytes
コンパイル時間 896 ms
コンパイル使用メモリ 88,124 KB
実行使用メモリ 24,132 KB
平均クエリ数 86.69
最終ジャッジ日時 2023-09-23 22:13:59
合計ジャッジ時間 2,307 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
23,472 KB
testcase_01 AC 30 ms
24,132 KB
testcase_02 AC 29 ms
23,472 KB
testcase_03 AC 29 ms
24,060 KB
testcase_04 AC 30 ms
23,412 KB
testcase_05 AC 30 ms
23,472 KB
testcase_06 AC 25 ms
23,532 KB
testcase_07 AC 30 ms
23,616 KB
testcase_08 AC 28 ms
23,520 KB
testcase_09 AC 29 ms
23,448 KB
testcase_10 AC 29 ms
24,096 KB
testcase_11 AC 28 ms
24,048 KB
testcase_12 AC 28 ms
24,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef pair<int, int> PI;
const double EPS=1e-9;

int solve(string &s, int v) {
  VI ans(10);
  int tot = 0;
  REP(i, 0, 10) {
    s[v] = '0' + i;
    cout << s << endl;
    int ret; string lock;
    cin >> ret >> lock;
    if (lock == "unlocked") {
      return 1;
    }
    ans[i] = ret;
    tot += ret;
  }
  REP(i, 0, 10) {
    if (ans[i] == tot / 10 + 1) {
      s[v] = '0' + i;
      return 0;
    }
  }
  assert(0);
}

int main(void){
  string s = "0000000000";
  REP(i, 0, 10) {
    if (solve(s, i)) {
      return 0;
    }
  }
}
0