QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#223992#5471. Interactive Number GuessingMihailo_JancevicAC ✓1ms3608kbC++14776b2023-10-22 22:48:482023-10-22 22:48:49

Judging History

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

  • [2023-10-22 22:48:49]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3608kb
  • [2023-10-22 22:48:48]
  • 提交

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;
    if(s==0) {
        cout<<"answer 0"<<'\n';
        exit(0);
    }
    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) {
            l=0;
            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: 0ms
memory: 3432kb

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: 0
Accepted
time: 1ms
memory: 3556kb

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
59
55
62
63
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
1
6
9
10
1

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 758625
query 50758625
q...

result:

ok correct

Test #3:

score: 0
Accepted
time: 1ms
memory: 3440kb

input:

88
93
87
95
83
81
80
79
84
78
77
76
72
70
78
66
64
63
62
58
65
57
44
60
43
48
51
52
43
48
42
41
49
46
40
48
45
39
47
35
42
43
31
38
39
27
34
35
23
30
31
19
17
16
15
2
18
1
6
9
10
1

output:

query 0
query 5
query 8
query 7
query 58
query 38
query 28
query 18
query 518
query 818
query 718
query 618
query 5618
query 3618
query 2618
query 53618
query 33618
query 23618
query 13618
query 513618
query 313618
query 413618
query 5413618
query 3413618
query 4413618
query 54413618
query 84413618
...

result:

ok correct

Test #4:

score: 0
Accepted
time: 1ms
memory: 3404kb

input:

95
91
98
99
87
94
95
83
81
89
77
75
74
82
79
73
72
80
68
66
65
64
51
49
66
54
57
58
49
54
48
47
46
42
40
39
47
44
47
39
35
33
41
29
27
35
23
21
20
28
25
19
18
17
13
11
10
9
14
8
7
6
2
9
1

output:

query 0
query 5
query 3
query 4
query 55
query 35
query 45
query 555
query 355
query 255
query 5355
query 3355
query 2355
query 1355
query 52355
query 82355
query 72355
query 62355
query 572355
query 372355
query 272355
query 172355
query 5172355
query 3172355
query 2172355
query 53172355
query 8317...

result:

ok correct

Test #5:

score: 0
Accepted
time: 1ms
memory: 3436kb

input:

75
80
74
73
72
77
71
70
78
66
64
63
71
59
66
58
54
61
53
58
52
51
50
55
49
48
47
52
46
45
53
41
39
38
37
42
45
37
42
36
35
34
39
33
32
40
28
26
25
33
21
28
20
25
28
20
16
23
15
11
9
17
5
3
2
1

output:

query 0
query 5
query 8
query 7
query 6
query 56
query 86
query 76
query 66
query 576
query 376
query 276
query 176
query 5276
query 3276
query 4276
query 54276
query 34276
query 44276
query 544276
query 844276
query 744276
query 644276
query 5644276
query 8644276
query 7644276
query 6644276
query 5...

result:

ok correct

Test #6:

score: 0
Accepted
time: 0ms
memory: 3436kb

input:

78
83
77
85
73
80
81
69
67
66
74
62
69
61
66
69
61
57
55
63
60
54
53
52
48
46
45
53
50
44
43
51
39
37
36
35
31
29
37
25
32
24
29
23
22
30
18
25
26
23
26
18
5
3
20
8
11
12
3
8
2
1
9

output:

query 0
query 5
query 8
query 7
query 58
query 38
query 48
query 558
query 358
query 258
query 158
query 5258
query 3258
query 4258
query 54258
query 84258
query 94258
query 594258
query 394258
query 294258
query 5394258
query 8394258
query 7394258
query 6394258
query 56394258
query 36394258
query 2...

result:

ok correct

Test #7:

score: 0
Accepted
time: 1ms
memory: 3376kb

input:

62
58
56
64
52
59
60
48
55
56
53
56
48
44
51
43
39
37
45
33
31
39
36
30
38
35
29
37
34
28
36
33
36
28
33
27
26
25
30
24
23
31
28
22
21
20
25
10
9
26
14
17
18
9
5
12
13
1
8
9

output:

query 0
query 5
query 3
query 2
query 53
query 33
query 43
query 553
query 353
query 453
query 5553
query 8553
query 9553
query 59553
query 39553
query 49553
query 549553
query 349553
query 249553
query 5349553
query 3349553
query 2349553
query 53349553
query 83349553
query 73349553
query 583349553
...

result:

ok correct

Test #8:

score: 0
Accepted
time: 1ms
memory: 3604kb

input:

46
51
54
55
46
51
45
53
50
53
45
32
48
49
37
40
41
32
37
31
39
36
30
29
28
33
36
28
33
18
35
23
26
27
18
23
17
25
22
16
15
23
11
9
17
14
8
7
15
12
15
7
12
6
5
4
9
3
2
1
6
9
1

output:

query 0
query 5
query 8
query 9
query 0
query 50
query 80
query 70
query 580
query 880
query 980
query 5980
query 3980
query 4980
query 55980
query 85980
query 95980
query 5980
query 505980
query 805980
query 705980
query 5805980
query 8805980
query 7805980
query 6805980
query 56805980
query 8680598...

result:

ok correct

Test #9:

score: 0
Accepted
time: 1ms
memory: 3432kb

input:

89
94
88
87
95
92
86
85
84
80
78
77
85
82
76
75
83
71
69
77
65
63
71
68
62
61
60
56
54
53
52
57
51
59
56
50
49
57
54
48
47
55
43
41
49
37
35
34
42
30
28
27
26
22
20
28
16
14
13
21
9
16
17
5
3
2
1

output:

query 0
query 5
query 8
query 7
query 6
query 57
query 87
query 77
query 67
query 567
query 367
query 267
query 167
query 5267
query 8267
query 7267
query 6267
query 57267
query 37267
query 27267
query 537267
query 337267
query 237267
query 5337267
query 8337267
query 7337267
query 6337267
query 563...

result:

ok correct

Test #10:

score: 0
Accepted
time: 0ms
memory: 3432kb

input:

63
68
71
72
63
68
62
61
69
66
60
59
67
64
58
57
65
53
60
61
58
34
60
39
42
43
34
39
42
43
34
30
28
27
26
31
34
26
22
20
28
25
19
18
17
22
16
24
21
15
14
13
9
7
6
14
11
5
13
10
4
12
9
3
2
1

output:

query 0
query 5
query 8
query 9
query 0
query 50
query 80
query 70
query 60
query 570
query 870
query 770
query 670
query 5770
query 8770
query 7770
query 6770
query 57770
query 37770
query 47770
query 557770
query 857770
query 757770
query 5857770
query 8857770
query 9857770
query 857770
query 5085...

result:

ok correct

Test #11:

score: 0
Accepted
time: 1ms
memory: 3436kb

input:

84
89
83
82
90
78
85
86
83
77
76
84
54
52
78
57
60
61
52
57
60
61
52
48
46
45
44
49
43
42
50
47
50
42
47
50
33
38
41
42
33
29
36
37
25
23
22
30
27
21
20
19
24
9
8
7
12
15
16
7
3
1
9
6
9
1

output:

query 0
query 5
query 8
query 7
query 6
query 57
query 37
query 47
query 557
query 857
query 757
query 657
query 5757
query 3757
query 2757
query 53757
query 83757
query 93757
query 3757
query 503757
query 803757
query 903757
query 3757
query 5003757
query 3003757
query 2003757
query 1003757
query 5...

result:

ok correct

Test #12:

score: 0
Accepted
time: 0ms
memory: 3352kb

input:

0

output:

query 0
answer 0

result:

ok correct

Test #13:

score: 0
Accepted
time: 1ms
memory: 3380kb

input:

18
23
26
18
23
17
25
22
16
24
21
15
23
20
14
22
19
13
21
18
12
20
17
11
19
16
10
18
15
9
17
14
8
16
13
7
15
12
6
14
11
5
13
10
4
12
9
3
11
8
2
10
7
1
9

output:

query 0
query 5
query 8
query 9
query 59
query 89
query 79
query 589
query 889
query 789
query 5889
query 8889
query 7889
query 58889
query 88889
query 78889
query 588889
query 888889
query 788889
query 5888889
query 8888889
query 7888889
query 58888889
query 88888889
query 78888889
query 588888889
...

result:

ok correct

Test #14:

score: 0
Accepted
time: 1ms
memory: 3440kb

input:

36
41
35
43
40
34
33
41
38
32
31
39
36
30
29
37
34
28
27
35
32
26
25
33
30
24
23
31
28
22
21
29
26
20
19
27
24
18
17
25
22
16
15
23
20
14
13
21
18
12
11
19
16
10
9
17
14
8
7
15
12
6
5
13
10
4
3
11
8
2
1
9

output:

query 0
query 5
query 8
query 7
query 58
query 88
query 78
query 68
query 578
query 878
query 778
query 678
query 5778
query 8778
query 7778
query 6778
query 57778
query 87778
query 77778
query 67778
query 577778
query 877778
query 777778
query 677778
query 5777778
query 8777778
query 7777778
query ...

result:

ok correct

Test #15:

score: 0
Accepted
time: 1ms
memory: 3372kb

input:

54
59
53
52
60
57
51
50
49
54
48
47
46
51
45
44
43
48
42
41
40
45
39
38
37
42
36
35
34
39
33
32
31
36
30
29
28
33
27
26
25
30
24
23
22
27
21
20
19
24
18
17
16
21
15
14
13
18
12
11
10
15
9
8
7
12
6
5
4
9
3
2
1

output:

query 0
query 5
query 8
query 7
query 6
query 57
query 87
query 77
query 67
query 567
query 867
query 767
query 667
query 5667
query 8667
query 7667
query 6667
query 56667
query 86667
query 76667
query 66667
query 566667
query 866667
query 766667
query 666667
query 5666667
query 8666667
query 766666...

result:

ok correct

Test #16:

score: 0
Accepted
time: 1ms
memory: 3564kb

input:

72
77
71
70
69
65
72
73
61
68
69
57
64
65
53
60
61
49
56
57
45
52
53
41
48
49
37
44
45
33
40
41
29
36
37
25
32
33
21
28
29
17
24
25
13
20
21
9
16
17
5
12
13
1
8
9

output:

query 0
query 5
query 8
query 7
query 6
query 56
query 36
query 46
query 556
query 356
query 456
query 5556
query 3556
query 4556
query 55556
query 35556
query 45556
query 555556
query 355556
query 455556
query 5555556
query 3555556
query 4555556
query 55555556
query 35555556
query 45555556
query 55...

result:

ok correct

Test #17:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

90
86
93
94
82
89
81
77
84
76
72
79
71
67
74
66
62
69
61
57
64
56
52
59
51
47
54
46
42
49
41
37
44
36
32
39
31
27
34
26
22
29
21
17
24
16
12
19
11
7
14
6
2
9
1

output:

query 0
query 5
query 3
query 4
query 55
query 35
query 45
query 545
query 345
query 445
query 5445
query 3445
query 4445
query 54445
query 34445
query 44445
query 544445
query 344445
query 444445
query 5444445
query 3444445
query 4444445
query 54444445
query 34444445
query 44444445
query 544444445
...

result:

ok correct

Test #18:

score: 0
Accepted
time: 0ms
memory: 3436kb

input:

108
104
111
103
99
97
105
93
91
99
87
85
93
81
79
87
75
73
81
69
67
75
63
61
69
57
55
63
51
49
57
45
43
51
39
37
45
33
31
39
27
25
33
21
19
27
15
13
21
9
7
15
3
1
9

output:

query 0
query 5
query 3
query 4
query 54
query 34
query 24
query 534
query 334
query 234
query 5334
query 3334
query 2334
query 53334
query 33334
query 23334
query 533334
query 333334
query 233334
query 5333334
query 3333334
query 2333334
query 53333334
query 33333334
query 23333334
query 533333334
...

result:

ok correct

Test #19:

score: 0
Accepted
time: 1ms
memory: 3436kb

input:

126
122
120
128
116
114
113
121
109
107
106
114
102
100
99
107
95
93
92
100
88
86
85
93
81
79
78
86
74
72
71
79
67
65
64
72
60
58
57
65
53
51
50
58
46
44
43
51
39
37
36
44
32
30
29
37
25
23
22
30
18
16
15
23
11
9
8
16
4
2
1
9

output:

query 0
query 5
query 3
query 2
query 53
query 33
query 23
query 13
query 523
query 323
query 223
query 123
query 5223
query 3223
query 2223
query 1223
query 52223
query 32223
query 22223
query 12223
query 522223
query 322223
query 222223
query 122223
query 5222223
query 3222223
query 2222223
query ...

result:

ok correct

Test #20:

score: 0
Accepted
time: 1ms
memory: 3444kb

input:

144
140
138
137
145
133
131
130
129
125
123
122
121
117
115
114
113
109
107
106
105
101
99
98
97
93
91
90
89
85
83
82
81
77
75
74
73
69
67
66
65
61
59
58
57
53
51
50
49
45
43
42
41
37
35
34
33
29
27
26
25
21
19
18
17
13
11
10
9
5
3
2
1

output:

query 0
query 5
query 3
query 2
query 1
query 52
query 32
query 22
query 12
query 512
query 312
query 212
query 112
query 5112
query 3112
query 2112
query 1112
query 51112
query 31112
query 21112
query 11112
query 511112
query 311112
query 211112
query 111112
query 5111112
query 3111112
query 211111...

result:

ok correct

Test #21:

score: 0
Accepted
time: 1ms
memory: 3496kb

input:

162
5
3
2
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1
6
9
10
1

output:

query 0
query 5
query 3
query 2
query 1
query 51
query 81
query 91
query 1
query 501
query 801
query 901
query 1
query 5001
query 8001
query 9001
query 1
query 50001
query 80001
query 90001
query 1
query 500001
query 800001
query 900001
query 1
query 5000001
query 8000001
query 9000001
query 1
query...

result:

ok correct

Test #22:

score: 0
Accepted
time: 1ms
memory: 3440kb

input:

10
6
13
14
2
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
6
9
1
6
9
1

output:

query 0
query 5
query 3
query 4
query 55
query 35
query 45
query 545
query 845
query 945
query 5945
query 8945
query 9945
query 59945
query 89945
query 99945
query 599945
query 899945
query 999945
query 5999945
query 8999945
query 9999945
query 59999945
query 89999945
query 99999945
query 599999945
...

result:

ok correct

Test #23:

score: 0
Accepted
time: 1ms
memory: 3376kb

input:

15
2
18
1
6
9
10
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
6
9
1
6
9
1

output:

query 0
query 5
query 3
query 4
query 54
query 84
query 94
query 4
query 504
query 804
query 904
query 5904
query 8904
query 9904
query 59904
query 89904
query 99904
query 599904
query 899904
query 999904
query 5999904
query 8999904
query 9999904
query 59999904
query 89999904
query 99999904
query 59...

result:

ok correct

Test #24:

score: 0
Accepted
time: 1ms
memory: 3348kb

input:

4
9
3
11
8
2
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
6
9
1

output:

query 0
query 5
query 8
query 7
query 58
query 88
query 78
query 68
query 578
query 878
query 978
query 5978
query 8978
query 9978
query 59978
query 89978
query 99978
query 599978
query 899978
query 999978
query 5999978
query 8999978
query 9999978
query 59999978
query 89999978
query 99999978
query 5...

result:

ok correct

Test #25:

score: 0
Accepted
time: 1ms
memory: 3444kb

input:

9
5
3
11
8
2
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
6
9
1

output:

query 0
query 5
query 3
query 2
query 53
query 83
query 73
query 63
query 573
query 873
query 973
query 5973
query 8973
query 9973
query 59973
query 89973
query 99973
query 599973
query 899973
query 999973
query 5999973
query 8999973
query 9999973
query 59999973
query 89999973
query 99999973
query 5...

result:

ok correct

Test #26:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

10
15
9
17
5
3
2
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
6
9
1
6
9
1

output:

query 0
query 5
query 8
query 7
query 58
query 38
query 28
query 18
query 518
query 818
query 918
query 5918
query 8918
query 9918
query 59918
query 89918
query 99918
query 599918
query 899918
query 999918
query 5999918
query 8999918
query 9999918
query 59999918
query 89999918
query 99999918
query 5...

result:

ok correct