QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#223982#5471. Interactive Number GuessingMihailo_JancevicWA 1ms3668kbC++14709b2023-10-22 22:43:252023-10-22 22:43:26

Judging History

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

  • [2023-10-22 22:43:26]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3668kb
  • [2023-10-22 22:43:25]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

long long a, l, r, m, s, s1, s2;

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cout<<"query 0"<<endl;
    cin>>s;
    for(long long i=1; i<1000000000000000000ll; i*=10) {
        l=1;
        r=10;
        while(l!=r) {
            m=(l+r)/2;
            cout<<"query "<<a+i*m<<endl;
            cin>>s1;
            if(s1==s+m) l=m+1;
            else r=m;
            if(r==m) s2=s1;
        }
        if(l==10&&i!=100000000000000000ll) {
            cout<<"query "<<a+i*l<<endl;
            cin>>s2;
        }
        a+=i*l;
        s=s2;
    }
    cout<<"answer "<<1000000000000000000ll-a<<'\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3668kb

input:

6
11
5
4
12
9
3
2
10
7
1
9
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1
6
9
1

output:

query 0
query 5
query 8
query 7
query 6
query 57
query 87
query 77
query 67
query 577
query 877
query 777
query 5877
query 8877
query 9877
query 59877
query 89877
query 99877
query 599877
query 899877
query 999877
query 5999877
query 8999877
query 9999877
query 59999877
query 89999877
query 99999877...

result:

ok correct

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3640kb

input:

89
85
92
93
81
79
78
86
83
77
76
75
80
74
82
70
77
78
75
60
59
76
64
67
68
60
56
63
55
60
54
62
50
48
56
44
51
52
40
38
46
34
32
31
39
27
25
24
23
28
22
30
27
3
2
1
6
9
10
2
7
10

output:

query 0
query 5
query 3
query 4
query 55
query 35
query 25
query 15
query 525
query 825
query 725
query 625
query 5625
query 8625
query 7625
query 58625
query 38625
query 48625
query 558625
query 858625
query 758625
query 658625
query 5758625
query 8758625
query 9758625
query 10758625
query 60758625...

result:

wrong answer invalid range in query_count=62: 1006812353850758625