QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#223958#5471. Interactive Number GuessingMihailo_JancevicWA 1ms3668kbC++14587b2023-10-22 22:33:292023-10-22 22:33:29

Judging History

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

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

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=9;
        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;
        }
        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: 3632kb

input:

6
11
4
12
9
2
10
7
9
1
6
8
9
6
8
9
6
8
9
6
8
9
6
8
9
6
8
9
6
8
9
6
8
9
6
8
9
6
8
9
6
8
9
6
8
9
6
8
9
6
8
9
6
8
9

output:

query 0
query 5
query 7
query 6
query 57
query 77
query 67
query 577
query 777
query 877
query 5877
query 7877
query 8877
query 59877
query 79877
query 89877
query 599877
query 799877
query 899877
query 5999877
query 7999877
query 8999877
query 59999877
query 79999877
query 89999877
query 599999877
...

result:

ok correct

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3668kb

input:

89
85
92
93
81
79
78
86
83
76
75
80
82
74
70
77
78
75
59
76
64
66
67
64
66
67
73
71
70
69
65
72
64
60
67
68
56
54
62
50
48
47
55
43
41
40
39
44
46
38
43
18
17
22
24
25
31
29
28
27

output:

query 0
query 5
query 3
query 4
query 55
query 35
query 25
query 15
query 525
query 725
query 625
query 5625
query 7625
query 8625
query 58625
query 38625
query 48625
query 558625
query 758625
query 658625
query 5758625
query 7758625
query 8758625
query 59758625
query 79758625
query 89758625
query 5...

result:

wrong answer wrong guess: 803187645800241375  actual: 993187646149241375