Submission #1425562


Source Code Expand

#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

bool flush(ll n) {
  cout << "? " << n << endl;
  char c;
  cin >> c;
  return (c == 'Y');
}

void answer(ll n) {
  cout << "! " << n << endl;
}

int main () {
  ll N = 0;
  while (N < 1000000000) {
    int ub = 9;
    int lb = ((N == 0) ? 0 : -1);
    while (ub - lb > 1) {
      int t = (ub + lb)/2;
      string str = to_string(N) + to_string(t) + "000000000";
      ll now = stoll(str);
      if (!flush(now)) {
        ub = t;
      } else {
        lb = t;
      }
    }
    N = stoll(to_string(N) + to_string(ub));
  }
  while (N % 10 == 0) {
    if (flush(N/10 + 1)) {
      N = N/10;
    } else {
      break;
    }
  }
  answer(N);
}

Submission Info

Submission Time
Task E - Awkward Response
User kazunetakahashi
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1664 Byte
Status WA
Exec Time 109 ms
Memory 596 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 800
Status
WA × 1
WA × 40
Set Name Test Cases
Sample 00_example_01.txt
All 00_example_01.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt
Case Name Status Exec Time Memory
00_example_01.txt WA 109 ms 592 KB
01.txt WA 4 ms 592 KB
02.txt WA 108 ms 592 KB
03.txt WA 4 ms 592 KB
04.txt WA 4 ms 596 KB
05.txt WA 108 ms 592 KB
06.txt WA 4 ms 588 KB
07.txt WA 107 ms 588 KB
08.txt WA 4 ms 592 KB
09.txt WA 104 ms 596 KB
10.txt WA 107 ms 596 KB
11.txt WA 106 ms 592 KB
12.txt WA 4 ms 592 KB
13.txt WA 107 ms 592 KB
14.txt WA 4 ms 592 KB
15.txt WA 4 ms 592 KB
16.txt WA 107 ms 592 KB
17.txt WA 4 ms 596 KB
18.txt WA 4 ms 592 KB
19.txt WA 4 ms 592 KB
20.txt WA 107 ms 596 KB
21.txt WA 106 ms 592 KB
22.txt WA 108 ms 592 KB
23.txt WA 104 ms 592 KB
24.txt WA 106 ms 592 KB
25.txt WA 105 ms 596 KB
26.txt WA 104 ms 592 KB
27.txt WA 108 ms 584 KB
28.txt WA 107 ms 592 KB
29.txt WA 109 ms 592 KB
30.txt WA 108 ms 592 KB
31.txt WA 4 ms 592 KB
32.txt WA 4 ms 584 KB
33.txt WA 4 ms 588 KB
34.txt WA 4 ms 592 KB
35.txt WA 4 ms 592 KB
36.txt WA 4 ms 592 KB
37.txt WA 4 ms 592 KB
38.txt WA 4 ms 596 KB
39.txt WA 4 ms 588 KB