QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#555193#5471. Interactive Number GuessingevirirAC ✓1ms3692kbC++20978b2024-09-09 20:31:392024-09-09 20:31:40

Judging History

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

  • [2024-09-09 20:31:40]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3692kb
  • [2024-09-09 20:31:39]
  • 提交

answer

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

#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define F first
#define S second
using ll = long long;
using ii = pair<ll, ll>;
using ld = long double;

ll query(ll x)
{
    cout<<"query "<<x<<endl;
    ll r; cin>>r;
    return r;
}

ll answer(ll x)
{
    cout<<"answer "<<x<<endl;
    exit(0);
}

int main()
{
    ll b = 1;
    ll ans = 0;
    ll ori = query(0);
    forn(i,0,18)
    {
        ll ba = 0;
        for (int L = 1, R = 9; L <= R; )
        {
            ll mid = (L + R) / 2;
            ll r = query(b * (10 - mid));
            if (r < ori + (10 - mid))
            {
                ba = mid;
                L = mid + 1;
            }
            else R = mid - 1;
        }
        ans += ba * b;
        b *= 10;
    }
    answer(ans);

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

query 0
query 5
query 8
query 7
query 6
query 50
query 80
query 70
query 500
query 800
query 900
query 5000
query 8000
query 9000
query 50000
query 80000
query 90000
query 500000
query 800000
query 900000
query 5000000
query 8000000
query 9000000
query 50000000
query 80000000
query 90000000
query 50...

result:

ok correct

Test #2:

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

input:

89
85
92
93
85
83
91
94
88
87
95
94
97
89
94
88
87
86
94
79
96
85
83
82
81
94
88
87
86
94
97
89
85
92
84
94
88
87
86
85
92
84
85
83
91
85
83
82
90
94
97
89
94
70
69
95
76
74
73
72
85
83
82
81

output:

query 0
query 5
query 3
query 4
query 50
query 30
query 20
query 500
query 800
query 700
query 600
query 5000
query 8000
query 9000
query 50000
query 80000
query 70000
query 60000
query 500000
query 800000
query 700000
query 5000000
query 3000000
query 2000000
query 1000000
query 50000000
query 8000...

result:

ok correct

Test #3:

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

input:

88
93
87
95
84
82
81
89
93
87
86
94
84
91
83
84
82
81
89
84
91
92
75
91
92
84
82
81
80
93
87
95
93
96
88
93
96
88
93
87
86
85
93
87
86
85
93
87
86
85
93
87
86
85
84
82
81
89
75
91
92
84
82
81
80

output:

query 0
query 5
query 8
query 7
query 50
query 30
query 20
query 10
query 500
query 800
query 700
query 600
query 5000
query 3000
query 4000
query 50000
query 30000
query 20000
query 10000
query 500000
query 300000
query 400000
query 5000000
query 3000000
query 4000000
query 50000000
query 30000000
...

result:

ok correct

Test #4:

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

input:

95
91
98
99
100
94
93
92
91
98
90
91
89
97
100
94
102
91
89
88
96
82
98
81
91
89
88
87
100
94
93
101
91
89
97
100
103
104
91
98
90
91
98
90
91
89
97
100
94
93
101
91
89
88
96
100
94
93
101
91
98
99

output:

query 0
query 5
query 3
query 4
query 50
query 80
query 70
query 60
query 500
query 300
query 400
query 5000
query 3000
query 2000
query 50000
query 80000
query 70000
query 500000
query 300000
query 200000
query 100000
query 5000000
query 3000000
query 4000000
query 50000000
query 30000000
query 200...

result:

ok correct

Test #5:

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

input:

75
80
74
73
72
80
74
82
71
69
77
71
78
79
71
78
79
80
74
73
81
80
74
73
81
80
74
82
71
69
68
76
80
83
84
80
74
73
81
80
74
82
71
69
77
71
78
79
80
83
84
71
78
79
71
78
70
71
69
68
76

output:

query 0
query 5
query 8
query 7
query 6
query 50
query 80
query 70
query 500
query 300
query 200
query 5000
query 3000
query 4000
query 50000
query 30000
query 40000
query 500000
query 800000
query 700000
query 600000
query 5000000
query 8000000
query 7000000
query 6000000
query 50000000
query 80000...

result:

ok correct

Test #6:

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

input:

78
83
77
85
83
77
76
75
74
72
80
74
81
82
83
86
87
74
81
73
83
77
76
84
74
72
80
83
77
85
74
72
71
79
74
81
73
74
81
82
83
77
85
83
77
76
75
83
86
87
65
81
64
74
72
71
70
83
77
85

output:

query 0
query 5
query 8
query 7
query 50
query 80
query 70
query 60
query 500
query 300
query 200
query 5000
query 3000
query 4000
query 50000
query 80000
query 90000
query 500000
query 300000
query 400000
query 5000000
query 8000000
query 7000000
query 6000000
query 50000000
query 30000000
query 20...

result:

ok correct

Test #7:

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

input:

62
58
56
64
67
61
60
59
67
61
60
59
67
70
71
58
65
66
58
65
57
58
65
57
67
70
62
67
70
62
67
70
62
67
70
71
67
61
60
68
67
61
69
67
61
60
68
67
52
69
58
56
55
54
67
61
60
59
67
61
60
59

output:

query 0
query 5
query 3
query 2
query 50
query 80
query 70
query 60
query 500
query 800
query 700
query 600
query 5000
query 8000
query 9000
query 50000
query 30000
query 40000
query 500000
query 300000
query 400000
query 5000000
query 3000000
query 4000000
query 50000000
query 80000000
query 900000...

result:

ok correct

Test #8:

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

input:

46
51
54
55
51
45
53
51
54
55
51
36
35
34
42
40
39
38
51
54
46
51
45
44
52
51
54
55
51
54
37
42
40
39
38
51
54
46
51
45
53
42
49
41
51
45
53
51
54
55
51
45
44
52
51
45
44
52
51
54
55

output:

query 0
query 5
query 8
query 9
query 50
query 80
query 70
query 500
query 800
query 900
query 5000
query 8000
query 7000
query 6000
query 50000
query 30000
query 20000
query 10000
query 500000
query 800000
query 900000
query 5000000
query 8000000
query 7000000
query 6000000
query 50000000
query 800...

result:

ok correct

Test #9:

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

input:

89
94
88
87
95
94
88
87
95
85
83
91
94
88
96
85
92
84
85
92
84
94
88
87
95
85
83
82
90
94
97
89
94
88
96
94
88
96
85
92
84
85
83
91
85
83
82
90
85
92
84
85
83
91
94
88
87
86
85
83
82
90

output:

query 0
query 5
query 8
query 7
query 6
query 50
query 80
query 70
query 60
query 500
query 300
query 200
query 5000
query 8000
query 7000
query 50000
query 30000
query 40000
query 500000
query 300000
query 400000
query 5000000
query 8000000
query 7000000
query 6000000
query 50000000
query 30000000
...

result:

ok correct

Test #10:

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

input:

63
68
71
72
68
62
61
69
68
62
70
68
62
70
68
62
61
60
68
71
45
50
48
47
46
59
57
56
55
59
57
56
64
68
71
72
59
66
58
68
62
61
69
68
71
63
68
62
61
69
59
57
65
68
71
63
68
71
63
68
62
61
69

output:

query 0
query 5
query 8
query 9
query 50
query 80
query 70
query 60
query 500
query 800
query 700
query 5000
query 8000
query 7000
query 50000
query 80000
query 70000
query 60000
query 500000
query 800000
query 900000
query 5000000
query 3000000
query 2000000
query 1000000
query 50000000
query 30000...

result:

ok correct

Test #11:

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

input:

84
89
83
82
90
89
83
82
81
89
83
91
62
87
61
71
69
68
67
80
78
77
76
80
78
77
85
89
83
91
89
92
93
89
92
93
80
78
77
76
89
83
82
81
80
78
86
89
83
82
90
89
74
73
90
80
78
77
76
80
87
79
89
92
93

output:

query 0
query 5
query 8
query 7
query 6
query 50
query 80
query 70
query 60
query 500
query 800
query 700
query 5000
query 3000
query 4000
query 50000
query 30000
query 20000
query 10000
query 500000
query 300000
query 200000
query 100000
query 5000000
query 3000000
query 2000000
query 1000000
query...

result:

ok correct

Test #12:

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

input:

0
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9
5
8
9

output:

query 0
query 5
query 8
query 9
query 50
query 80
query 90
query 500
query 800
query 900
query 5000
query 8000
query 9000
query 50000
query 80000
query 90000
query 500000
query 800000
query 900000
query 5000000
query 8000000
query 9000000
query 50000000
query 80000000
query 90000000
query 500000000
...

result:

ok correct

Test #13:

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

input:

18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18
23
26
18

output:

query 0
query 5
query 8
query 9
query 50
query 80
query 90
query 500
query 800
query 900
query 5000
query 8000
query 9000
query 50000
query 80000
query 90000
query 500000
query 800000
query 900000
query 5000000
query 8000000
query 9000000
query 50000000
query 80000000
query 90000000
query 500000000
...

result:

ok correct

Test #14:

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

input:

36
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43
41
35
43

output:

query 0
query 5
query 8
query 7
query 50
query 80
query 70
query 500
query 800
query 700
query 5000
query 8000
query 7000
query 50000
query 80000
query 70000
query 500000
query 800000
query 700000
query 5000000
query 8000000
query 7000000
query 50000000
query 80000000
query 70000000
query 500000000
...

result:

ok correct

Test #15:

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

input:

54
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60
59
53
52
60

output:

query 0
query 5
query 8
query 7
query 6
query 50
query 80
query 70
query 60
query 500
query 800
query 700
query 600
query 5000
query 8000
query 7000
query 6000
query 50000
query 80000
query 70000
query 60000
query 500000
query 800000
query 700000
query 600000
query 5000000
query 8000000
query 700000...

result:

ok correct

Test #16:

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

input:

72
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69
77
71
70
69

output:

query 0
query 5
query 8
query 7
query 6
query 50
query 80
query 70
query 60
query 500
query 800
query 700
query 600
query 5000
query 8000
query 7000
query 6000
query 50000
query 80000
query 70000
query 60000
query 500000
query 800000
query 700000
query 600000
query 5000000
query 8000000
query 700000...

result:

ok correct

Test #17:

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

input:

90
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94
86
93
94

output:

query 0
query 5
query 3
query 4
query 50
query 30
query 40
query 500
query 300
query 400
query 5000
query 3000
query 4000
query 50000
query 30000
query 40000
query 500000
query 300000
query 400000
query 5000000
query 3000000
query 4000000
query 50000000
query 30000000
query 40000000
query 500000000
...

result:

ok correct

Test #18:

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

input:

108
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103
104
111
103

output:

query 0
query 5
query 3
query 4
query 50
query 30
query 40
query 500
query 300
query 400
query 5000
query 3000
query 4000
query 50000
query 30000
query 40000
query 500000
query 300000
query 400000
query 5000000
query 3000000
query 4000000
query 50000000
query 30000000
query 40000000
query 500000000
...

result:

ok correct

Test #19:

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

input:

126
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128
122
120
128

output:

query 0
query 5
query 3
query 2
query 50
query 30
query 20
query 500
query 300
query 200
query 5000
query 3000
query 2000
query 50000
query 30000
query 20000
query 500000
query 300000
query 200000
query 5000000
query 3000000
query 2000000
query 50000000
query 30000000
query 20000000
query 500000000
...

result:

ok correct

Test #20:

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

input:

144
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145
140
138
137
145

output:

query 0
query 5
query 3
query 2
query 1
query 50
query 30
query 20
query 10
query 500
query 300
query 200
query 100
query 5000
query 3000
query 2000
query 1000
query 50000
query 30000
query 20000
query 10000
query 500000
query 300000
query 200000
query 100000
query 5000000
query 3000000
query 200000...

result:

ok correct

Test #21:

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

input:

162
5
3
2
1
14
12
11
10
23
21
20
19
32
30
29
28
41
39
38
37
50
48
47
46
59
57
56
55
68
66
65
64
77
75
74
73
86
84
83
82
95
93
92
91
104
102
101
100
113
111
110
109
122
120
119
118
131
129
128
127
140
138
137
136
149
147
146
145
158
156
155
154

output:

query 0
query 5
query 3
query 2
query 1
query 50
query 30
query 20
query 10
query 500
query 300
query 200
query 100
query 5000
query 3000
query 2000
query 1000
query 50000
query 30000
query 20000
query 10000
query 500000
query 300000
query 200000
query 100000
query 5000000
query 3000000
query 200000...

result:

ok correct

Test #22:

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

input:

10
6
13
14
6
13
14
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19

output:

query 0
query 5
query 3
query 4
query 50
query 30
query 40
query 500
query 800
query 900
query 5000
query 8000
query 9000
query 50000
query 80000
query 90000
query 500000
query 800000
query 900000
query 5000000
query 8000000
query 9000000
query 50000000
query 80000000
query 90000000
query 500000000
...

result:

ok correct

Test #23:

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

input:

15
2
18
1
11
9
8
7
20
23
24
20
23
24
20
23
24
20
23
24
20
23
24
20
23
24
20
23
24
20
23
24
20
23
24
20
23
24
20
23
24
20
23
24
20
23
24
20
23
24
20
23
24
20
23
24

output:

query 0
query 5
query 3
query 4
query 50
query 30
query 20
query 10
query 500
query 800
query 900
query 5000
query 8000
query 9000
query 50000
query 80000
query 90000
query 500000
query 800000
query 900000
query 5000000
query 8000000
query 9000000
query 50000000
query 80000000
query 90000000
query 5...

result:

ok correct

Test #24:

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

input:

4
9
3
11
9
3
11
9
12
13
9
12
13
9
12
13
9
12
13
9
12
13
9
12
13
9
12
13
9
12
13
9
12
13
9
12
13
9
12
13
9
12
13
9
12
13
9
12
13
9
12
13
9
12
13

output:

query 0
query 5
query 8
query 7
query 50
query 80
query 70
query 500
query 800
query 900
query 5000
query 8000
query 9000
query 50000
query 80000
query 90000
query 500000
query 800000
query 900000
query 5000000
query 8000000
query 9000000
query 50000000
query 80000000
query 90000000
query 500000000
...

result:

ok correct

Test #25:

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

input:

9
5
3
11
14
8
16
14
17
18
14
17
18
14
17
18
14
17
18
14
17
18
14
17
18
14
17
18
14
17
18
14
17
18
14
17
18
14
17
18
14
17
18
14
17
18
14
17
18
14
17
18
14
17
18

output:

query 0
query 5
query 3
query 2
query 50
query 80
query 70
query 500
query 800
query 900
query 5000
query 8000
query 9000
query 50000
query 80000
query 90000
query 500000
query 800000
query 900000
query 5000000
query 8000000
query 9000000
query 50000000
query 80000000
query 90000000
query 500000000
...

result:

ok correct

Test #26:

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

input:

10
15
9
17
6
4
3
11
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19
15
18
19

output:

query 0
query 5
query 8
query 7
query 50
query 30
query 20
query 10
query 500
query 800
query 900
query 5000
query 8000
query 9000
query 50000
query 80000
query 90000
query 500000
query 800000
query 900000
query 5000000
query 8000000
query 9000000
query 50000000
query 80000000
query 90000000
query 5...

result:

ok correct