Submission #1434327
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) { assert(1 <= n && n <= 1000000000000000000); cout << "? " << n << endl; char c; cin >> c; return (c == 'Y'); } void answer(ll n) { assert(1 <= n && n <= 1000000000); cout << "! " << n << endl; } void solve1() { ll ask = 2; while (true) { if (flush(ask)) { answer(ask/2); return; } else { ask *= 10; } } } void solve2() { ll ask = 1e8; while (true) { if (flush(ask)) { break; } else { ask /= 10; } } ll lb = ask + 1; ll ub = ask * 10; while (ub - lb > 1) { ll t = (ub + lb) / 2; if (flush(t * 10)) { ub = t; } else { lb = t; } } answer(lb); } int main () { if (flush(1e9)) { solve1(); } else { solve2(); } }
Submission Info
Submission Time | |
---|---|
Task | E - Awkward Response |
User | kazunetakahashi |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1798 Byte |
Status | WA |
Exec Time | 4 ms |
Memory | 596 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 800 | ||||||
Status |
|
|
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 | 4 ms | 592 KB |
01.txt | WA | 4 ms | 592 KB |
02.txt | WA | 4 ms | 592 KB |
03.txt | WA | 4 ms | 588 KB |
04.txt | WA | 4 ms | 592 KB |
05.txt | WA | 4 ms | 592 KB |
06.txt | WA | 4 ms | 592 KB |
07.txt | WA | 4 ms | 596 KB |
08.txt | WA | 4 ms | 592 KB |
09.txt | AC | 3 ms | 588 KB |
10.txt | WA | 3 ms | 592 KB |
11.txt | WA | 4 ms | 588 KB |
12.txt | WA | 4 ms | 588 KB |
13.txt | WA | 4 ms | 592 KB |
14.txt | WA | 4 ms | 592 KB |
15.txt | WA | 4 ms | 592 KB |
16.txt | WA | 4 ms | 592 KB |
17.txt | WA | 4 ms | 592 KB |
18.txt | WA | 3 ms | 592 KB |
19.txt | WA | 4 ms | 592 KB |
20.txt | WA | 4 ms | 596 KB |
21.txt | AC | 3 ms | 596 KB |
22.txt | AC | 3 ms | 592 KB |
23.txt | AC | 3 ms | 592 KB |
24.txt | AC | 3 ms | 592 KB |
25.txt | AC | 3 ms | 588 KB |
26.txt | AC | 3 ms | 592 KB |
27.txt | AC | 3 ms | 596 KB |
28.txt | AC | 3 ms | 592 KB |
29.txt | AC | 3 ms | 588 KB |
30.txt | AC | 3 ms | 592 KB |
31.txt | WA | 3 ms | 592 KB |
32.txt | WA | 4 ms | 596 KB |
33.txt | WA | 4 ms | 592 KB |
34.txt | WA | 4 ms | 592 KB |
35.txt | WA | 4 ms | 596 KB |
36.txt | WA | 4 ms | 592 KB |
37.txt | WA | 4 ms | 596 KB |
38.txt | WA | 4 ms | 588 KB |
39.txt | WA | 4 ms | 596 KB |