QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#245736#5471. Interactive Number GuessingFireball0424#WA 1ms3556kbC++141.2kb2023-11-10 10:51:352023-11-10 10:51:37

Judging History

你现在查看的是最新测评结果

  • [2023-11-10 10:51:37]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3556kb
  • [2023-11-10 10:51:35]
  • 提交

answer

#pragma GCC optimizer("Ofast")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
#define int long long 
#define ld long double
#define ull unsigned long long 
#define fr first
#define fi first
#define sc second
#define se second
#define all(x) x.begin(), x.end()
#define pii pair<int,int>
using namespace std;

#ifndef fireball
#define tofu ios::sync_with_stdio(0); cin.tie(0);
#else
#define tofu freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif 

void db() {cout << '\n';}
template <typename T, typename ...U> void db(T a, U ...b) {cout << a << ' ', db(b...);}

int ask(int x){
    cout << "query " << x << endl;
    int res; cin >> res;
    return res;
}

signed main(){
    int n = ask(0);
    int ans = 0, base = 1;
    for(int i = 0; i < 18; ++i){
        int l = 1, r = 10, res = -1;
        while(l <= r){
            int mid = (l + r) >> 1;
            int tmp = ask(mid * base);
            if(mid + n != tmp){
                r = mid - 1;
                res = mid;
            }
            else l = mid + 1;
        }

        if(~res) ans += base * (10 - res);
        base *= 10;
    }
    cout << "answer " << ans << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3556kb

input:

6
11
5
12
4
11
5
12
13
11
14
6
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15
7
11
14
15

output:

query 0
query 5
query 8
query 6
query 7
query 50
query 80
query 60
query 70
query 500
query 800
query 900
query 5000
query 8000
query 9000
query 10000
query 50000
query 80000
query 90000
query 100000
query 500000
query 800000
query 900000
query 1000000
query 5000000
query 8000000
query 9000000
query...

result:

wrong answer invalid range in query_count=71: 1000000000000000000