QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#86050#5471. Interactive Number GuessingpjshwaAC ✓6ms3572kbC++171.2kb2023-03-09 10:50:492023-03-09 10:50:50

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-09 10:50:50]
  • 评测
  • 测评结果:AC
  • 用时:6ms
  • 内存:3572kb
  • [2023-03-09 10:50:49]
  • 提交

answer

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

void fast_io() {
  cin.tie(nullptr)->sync_with_stdio(false);
}

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

void solve() {
  ll osum = ask(0), ans = 0;

  ll pre = 1;
  for (int b = 0; b < 18; b++) {
    ll m1 = ask(3 * pre), m2 = ask(7 * pre), cur;

    // Candidate is in [4, 7]
    if (m1 >= m2) {
      ll m3 = ask(5 * pre);
      if (m1 >= m3) {
        ll m4 = ask(4 * pre);
        cur = m1 >= m4 ? 4 : 5;
      }
      else {
        ll m4 = ask(6 * pre);
        cur = m3 >= m4 ? 6 : 7;
      }
    }

    // Candidate is in [1, 3]
    else if (osum >= m1) {
      ll m3 = ask(1 * pre), m4 = ask(2 * pre);
      if (osum >= m3) cur = 1;
      else if (m3 >= m4) cur = 2;
      else cur = 3;
    }

    // Candidate is in [8, 9]
    else {
      ll m3 = ask(8 * pre), m4 = ask(9 * pre);
      if (m4 > osum) cur = 0;
      else if (m3 >= m4) cur = 9;
      else cur = 8;
    }

    cur = (10 - cur) % 10;
    ans += cur * pre;
    pre *= 10;
  }

  cout << "answer " << ans << endl;
}

int main() {
  // fast_io();

  int t = 1;
  // cin >> t;
  while (t--) solve();
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3504kb

input:

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

output:

query 0
query 3
query 7
query 5
query 6
query 30
query 70
query 80
query 90
query 300
query 700
query 800
query 900
query 3000
query 7000
query 8000
query 9000
query 30000
query 70000
query 80000
query 90000
query 300000
query 700000
query 800000
query 900000
query 3000000
query 7000000
query 800000...

result:

ok correct

Test #2:

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

input:

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

output:

query 0
query 3
query 7
query 5
query 4
query 30
query 70
query 10
query 20
query 300
query 700
query 500
query 600
query 3000
query 7000
query 8000
query 9000
query 30000
query 70000
query 50000
query 60000
query 300000
query 700000
query 800000
query 900000
query 3000000
query 7000000
query 100000...

result:

ok correct

Test #3:

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

input:

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

output:

query 0
query 3
query 7
query 8
query 9
query 30
query 70
query 10
query 20
query 300
query 700
query 500
query 600
query 3000
query 7000
query 5000
query 4000
query 30000
query 70000
query 10000
query 20000
query 300000
query 700000
query 500000
query 400000
query 3000000
query 7000000
query 500000...

result:

ok correct

Test #4:

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

input:

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

output:

query 0
query 3
query 7
query 5
query 4
query 30
query 70
query 50
query 60
query 300
query 700
query 500
query 400
query 3000
query 7000
query 1000
query 2000
query 30000
query 70000
query 80000
query 90000
query 300000
query 700000
query 100000
query 200000
query 3000000
query 7000000
query 500000...

result:

ok correct

Test #5:

score: 0
Accepted
time: 3ms
memory: 3420kb

input:

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

output:

query 0
query 3
query 7
query 5
query 6
query 30
query 70
query 80
query 90
query 300
query 700
query 100
query 200
query 3000
query 7000
query 5000
query 4000
query 30000
query 70000
query 50000
query 40000
query 300000
query 700000
query 500000
query 600000
query 3000000
query 7000000
query 500000...

result:

ok correct

Test #6:

score: 0
Accepted
time: 6ms
memory: 3268kb

input:

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

output:

query 0
query 3
query 7
query 8
query 9
query 30
query 70
query 50
query 60
query 300
query 700
query 100
query 200
query 3000
query 7000
query 5000
query 4000
query 30000
query 70000
query 80000
query 90000
query 300000
query 700000
query 500000
query 400000
query 3000000
query 7000000
query 500000...

result:

ok correct

Test #7:

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

input:

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

output:

query 0
query 3
query 7
query 1
query 2
query 30
query 70
query 50
query 60
query 300
query 700
query 500
query 600
query 3000
query 7000
query 8000
query 9000
query 30000
query 70000
query 50000
query 40000
query 300000
query 700000
query 500000
query 400000
query 3000000
query 7000000
query 500000...

result:

ok correct

Test #8:

score: 0
Accepted
time: 3ms
memory: 3420kb

input:

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

output:

query 0
query 3
query 7
query 8
query 9
query 30
query 70
query 80
query 90
query 300
query 700
query 800
query 900
query 3000
query 7000
query 5000
query 6000
query 30000
query 70000
query 10000
query 20000
query 300000
query 700000
query 800000
query 900000
query 3000000
query 7000000
query 500000...

result:

ok correct

Test #9:

score: 0
Accepted
time: 6ms
memory: 3268kb

input:

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

output:

query 0
query 3
query 7
query 5
query 6
query 30
query 70
query 50
query 60
query 300
query 700
query 100
query 200
query 3000
query 7000
query 8000
query 9000
query 30000
query 70000
query 50000
query 40000
query 300000
query 700000
query 500000
query 400000
query 3000000
query 7000000
query 500000...

result:

ok correct

Test #10:

score: 0
Accepted
time: 5ms
memory: 3360kb

input:

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

output:

query 0
query 3
query 7
query 8
query 9
query 30
query 70
query 50
query 60
query 300
query 700
query 800
query 900
query 3000
query 7000
query 8000
query 9000
query 30000
query 70000
query 50000
query 60000
query 300000
query 700000
query 800000
query 900000
query 3000000
query 7000000
query 100000...

result:

ok correct

Test #11:

score: 0
Accepted
time: 5ms
memory: 3572kb

input:

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

output:

query 0
query 3
query 7
query 5
query 6
query 30
query 70
query 50
query 60
query 300
query 700
query 800
query 900
query 3000
query 7000
query 5000
query 4000
query 30000
query 70000
query 10000
query 20000
query 300000
query 700000
query 100000
query 200000
query 3000000
query 7000000
query 100000...

result:

ok correct

Test #12:

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

input:

0
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9
3
7
8
9

output:

query 0
query 3
query 7
query 8
query 9
query 30
query 70
query 80
query 90
query 300
query 700
query 800
query 900
query 3000
query 7000
query 8000
query 9000
query 30000
query 70000
query 80000
query 90000
query 300000
query 700000
query 800000
query 900000
query 3000000
query 7000000
query 800000...

result:

ok correct

Test #13:

score: 0
Accepted
time: 2ms
memory: 3240kb

input:

18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18
21
25
26
18

output:

query 0
query 3
query 7
query 8
query 9
query 30
query 70
query 80
query 90
query 300
query 700
query 800
query 900
query 3000
query 7000
query 8000
query 9000
query 30000
query 70000
query 80000
query 90000
query 300000
query 700000
query 800000
query 900000
query 3000000
query 7000000
query 800000...

result:

ok correct

Test #14:

score: 0
Accepted
time: 3ms
memory: 3332kb

input:

36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36
39
43
35
36

output:

query 0
query 3
query 7
query 8
query 9
query 30
query 70
query 80
query 90
query 300
query 700
query 800
query 900
query 3000
query 7000
query 8000
query 9000
query 30000
query 70000
query 80000
query 90000
query 300000
query 700000
query 800000
query 900000
query 3000000
query 7000000
query 800000...

result:

ok correct

Test #15:

score: 0
Accepted
time: 4ms
memory: 3504kb

input:

54
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60
57
52
59
60

output:

query 0
query 3
query 7
query 5
query 6
query 30
query 70
query 50
query 60
query 300
query 700
query 500
query 600
query 3000
query 7000
query 5000
query 6000
query 30000
query 70000
query 50000
query 60000
query 300000
query 700000
query 500000
query 600000
query 3000000
query 7000000
query 500000...

result:

ok correct

Test #16:

score: 0
Accepted
time: 3ms
memory: 3384kb

input:

72
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69
75
70
77
69

output:

query 0
query 3
query 7
query 5
query 6
query 30
query 70
query 50
query 60
query 300
query 700
query 500
query 600
query 3000
query 7000
query 5000
query 6000
query 30000
query 70000
query 50000
query 60000
query 300000
query 700000
query 500000
query 600000
query 3000000
query 7000000
query 500000...

result:

ok correct

Test #17:

score: 0
Accepted
time: 5ms
memory: 3332kb

input:

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

output:

query 0
query 3
query 7
query 5
query 4
query 30
query 70
query 50
query 40
query 300
query 700
query 500
query 400
query 3000
query 7000
query 5000
query 4000
query 30000
query 70000
query 50000
query 40000
query 300000
query 700000
query 500000
query 400000
query 3000000
query 7000000
query 500000...

result:

ok correct

Test #18:

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

input:

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

output:

query 0
query 3
query 7
query 5
query 4
query 30
query 70
query 50
query 40
query 300
query 700
query 500
query 400
query 3000
query 7000
query 5000
query 4000
query 30000
query 70000
query 50000
query 40000
query 300000
query 700000
query 500000
query 400000
query 3000000
query 7000000
query 500000...

result:

ok correct

Test #19:

score: 0
Accepted
time: 5ms
memory: 3416kb

input:

126
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128
120
124
127
128

output:

query 0
query 3
query 7
query 1
query 2
query 30
query 70
query 10
query 20
query 300
query 700
query 100
query 200
query 3000
query 7000
query 1000
query 2000
query 30000
query 70000
query 10000
query 20000
query 300000
query 700000
query 100000
query 200000
query 3000000
query 7000000
query 100000...

result:

ok correct

Test #20:

score: 0
Accepted
time: 4ms
memory: 3504kb

input:

144
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137
138
142
145
137

output:

query 0
query 3
query 7
query 1
query 2
query 30
query 70
query 10
query 20
query 300
query 700
query 100
query 200
query 3000
query 7000
query 1000
query 2000
query 30000
query 70000
query 10000
query 20000
query 300000
query 700000
query 100000
query 200000
query 3000000
query 7000000
query 100000...

result:

ok correct

Test #21:

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

input:

162
3
7
1
2
12
16
10
11
21
25
19
20
30
34
28
29
39
43
37
38
48
52
46
47
57
61
55
56
66
70
64
65
75
79
73
74
84
88
82
83
93
97
91
92
102
106
100
101
111
115
109
110
120
124
118
119
129
133
127
128
138
142
136
137
147
151
145
146
156
160
154
155

output:

query 0
query 3
query 7
query 1
query 2
query 30
query 70
query 10
query 20
query 300
query 700
query 100
query 200
query 3000
query 7000
query 1000
query 2000
query 30000
query 70000
query 10000
query 20000
query 300000
query 700000
query 100000
query 200000
query 3000000
query 7000000
query 100000...

result:

ok correct

Test #22:

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

input:

10
13
8
6
14
13
8
6
14
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19

output:

query 0
query 3
query 7
query 5
query 4
query 30
query 70
query 50
query 40
query 300
query 700
query 800
query 900
query 3000
query 7000
query 8000
query 9000
query 30000
query 70000
query 80000
query 90000
query 300000
query 700000
query 800000
query 900000
query 3000000
query 7000000
query 800000...

result:

ok correct

Test #23:

score: 0
Accepted
time: 6ms
memory: 3384kb

input:

15
18
4
2
1
9
13
7
8
18
22
23
24
18
22
23
24
18
22
23
24
18
22
23
24
18
22
23
24
18
22
23
24
18
22
23
24
18
22
23
24
18
22
23
24
18
22
23
24
18
22
23
24
18
22
23
24
18
22
23
24
18
22
23
24
18
22
23
24
18
22
23
24

output:

query 0
query 3
query 7
query 5
query 4
query 30
query 70
query 10
query 20
query 300
query 700
query 800
query 900
query 3000
query 7000
query 8000
query 9000
query 30000
query 70000
query 80000
query 90000
query 300000
query 700000
query 800000
query 900000
query 3000000
query 7000000
query 800000...

result:

ok correct

Test #24:

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

input:

4
7
11
3
4
7
11
3
4
7
11
12
13
7
11
12
13
7
11
12
13
7
11
12
13
7
11
12
13
7
11
12
13
7
11
12
13
7
11
12
13
7
11
12
13
7
11
12
13
7
11
12
13
7
11
12
13
7
11
12
13
7
11
12
13
7
11
12
13
7
11
12
13

output:

query 0
query 3
query 7
query 8
query 9
query 30
query 70
query 80
query 90
query 300
query 700
query 800
query 900
query 3000
query 7000
query 8000
query 9000
query 30000
query 70000
query 80000
query 90000
query 300000
query 700000
query 800000
query 900000
query 3000000
query 7000000
query 800000...

result:

ok correct

Test #25:

score: 0
Accepted
time: 3ms
memory: 3388kb

input:

9
3
7
10
11
12
16
8
9
12
16
17
18
12
16
17
18
12
16
17
18
12
16
17
18
12
16
17
18
12
16
17
18
12
16
17
18
12
16
17
18
12
16
17
18
12
16
17
18
12
16
17
18
12
16
17
18
12
16
17
18
12
16
17
18
12
16
17
18
12
16
17
18

output:

query 0
query 3
query 7
query 1
query 2
query 30
query 70
query 80
query 90
query 300
query 700
query 800
query 900
query 3000
query 7000
query 8000
query 9000
query 30000
query 70000
query 80000
query 90000
query 300000
query 700000
query 800000
query 900000
query 3000000
query 7000000
query 800000...

result:

ok correct

Test #26:

score: 0
Accepted
time: 3ms
memory: 3368kb

input:

10
13
17
9
10
4
8
11
3
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19
13
17
18
19

output:

query 0
query 3
query 7
query 8
query 9
query 30
query 70
query 10
query 20
query 300
query 700
query 800
query 900
query 3000
query 7000
query 8000
query 9000
query 30000
query 70000
query 80000
query 90000
query 300000
query 700000
query 800000
query 900000
query 3000000
query 7000000
query 800000...

result:

ok correct