Submission #1865949
Source Code Expand
// #include {{{ #include <iostream> #include <cassert> #include <cstring> #include <cstdlib> #include <cstdio> #include <cctype> #include <cmath> #include <ctime> #include <queue> #include <set> #include <map> #include <stack> #include <string> #include <bitset> #include <vector> #include <complex> #include <algorithm> using namespace std; // }}} // #define {{{ typedef long long ll; typedef double db; typedef pair<int,int> pii; typedef vector<int> vi; #define de(x) cout << #x << "=" << x << endl #define rep(i,a,b) for(int i=a;i<(b);++i) #define per(i,a,b) for(int i=(b)-1;i>=(a);--i) #define all(x) (x).begin(),(x).end() #define sz(x) (int)(x).size() #define mp make_pair #define pb push_back #define fi first #define se second // }}} int N; string str(ll n){ stringstream ss; ss << n; string s; ss >> s; return s; } bool check(ll n,ll N) { return (n <= N && str(n) <= str(N)) || (n > N && str(n) > str(N)); } bool ask(ll n){ printf("? %lld\n",n); fflush(stdout); #ifdef LOCAL return check(n , N); #endif static char s[100]; scanf("%s",s); return s[0] == 'Y'; } void answer(ll x){ printf("! %lld\n",x); exit(0); } int main(){ srand(time(NULL)); N = rand() + 1; ll x = 1 , l = -1 , r = -1; rep(i,0,11) { if(!ask(x) && l == -1) { l = x , r = x * 10; } x *= 10; } /*if(l == -1) { for(ll x=10;;x*=10) { if(ask(x - 1)) { answer(x / 10); } } } else {*/ while(l + 1 < r) { ll m = (l + r) >> 1; if(ask(m)) r = m; else l = m; } answer(r / 10); //} return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Awkward Response |
User | Thefinal |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1806 Byte |
Status | WA |
Exec Time | 4 ms |
Memory | 648 KB |
Compile Error
./Main.cpp: In function ‘bool ask(ll)’: ./Main.cpp:58:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s",s); ^
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 | AC | 4 ms | 592 KB |
01.txt | AC | 4 ms | 592 KB |
02.txt | AC | 4 ms | 592 KB |
03.txt | AC | 4 ms | 592 KB |
04.txt | AC | 4 ms | 592 KB |
05.txt | AC | 4 ms | 592 KB |
06.txt | AC | 4 ms | 592 KB |
07.txt | AC | 4 ms | 596 KB |
08.txt | AC | 4 ms | 592 KB |
09.txt | AC | 3 ms | 592 KB |
10.txt | AC | 4 ms | 592 KB |
11.txt | AC | 4 ms | 588 KB |
12.txt | AC | 4 ms | 592 KB |
13.txt | AC | 4 ms | 592 KB |
14.txt | AC | 4 ms | 592 KB |
15.txt | AC | 4 ms | 592 KB |
16.txt | AC | 4 ms | 596 KB |
17.txt | AC | 4 ms | 592 KB |
18.txt | AC | 3 ms | 592 KB |
19.txt | AC | 4 ms | 596 KB |
20.txt | AC | 4 ms | 592 KB |
21.txt | WA | 3 ms | 592 KB |
22.txt | WA | 3 ms | 592 KB |
23.txt | WA | 3 ms | 592 KB |
24.txt | WA | 3 ms | 592 KB |
25.txt | WA | 3 ms | 592 KB |
26.txt | WA | 3 ms | 592 KB |
27.txt | WA | 3 ms | 592 KB |
28.txt | WA | 3 ms | 592 KB |
29.txt | WA | 3 ms | 592 KB |
30.txt | WA | 3 ms | 592 KB |
31.txt | AC | 4 ms | 596 KB |
32.txt | AC | 3 ms | 588 KB |
33.txt | AC | 4 ms | 592 KB |
34.txt | AC | 4 ms | 648 KB |
35.txt | AC | 4 ms | 588 KB |
36.txt | AC | 4 ms | 588 KB |
37.txt | AC | 4 ms | 592 KB |
38.txt | AC | 4 ms | 592 KB |
39.txt | AC | 4 ms | 592 KB |