QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#60086#1894. Guess the ArraySa3tElSefr#AC ✓155ms4264kbC++232.0kb2022-11-02 20:17:062022-11-02 20:17:09

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-02 20:17:09]
  • Judged
  • Verdict: AC
  • Time: 155ms
  • Memory: 4264kb
  • [2022-11-02 20:17:06]
  • Submitted

answer

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <climits>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <climits>

//#pragma GCC optimize("O3")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#define ll long long
#define ld  double
using namespace std;

const int N = 5e2 + 5, lg = 19, mod = 998244353;
const int M = 1e6 + 5;
const int b = 31;

set<pair<int, int> >blocked;
vector<int> ans;
vector<ll> pref_sum;

bool is_blocked(int st, int en) {
    return blocked.find({st, en}) != blocked.end();
}

ll ask(int st, int en) {
    cout << "? " << st << ' ' << en << endl;
    ll sum, l_b, r_b;
    cin >> sum >> l_b >> r_b;
    blocked.emplace(l_b, r_b);
    return sum;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    ll cum = 0;
    ans.resize(n + 1);
    pref_sum.resize(n + 1);
    for (int i = 1; i <= n; ++i) {
        int st = 1;
        while (is_blocked(st, i)) {
            ++st;
        }
        ll sum = ask(st, i);
        ans[i] = sum - (pref_sum[i - 1] - pref_sum[st - 1]);
        pref_sum[i] = pref_sum[i - 1] + ans[i];
    }
    cout << "!" << endl;
    for (int i = 1; i <= n; ++i) {
        cout << ans[i] << ' ';
    }
    cout << endl;
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 1 2
2 1 3
5 3 3

output:

? 1 1
? 2 2
? 2 3
!
1 2 3 

result:

ok ok, 3 queries

Test #2:

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

input:

1
-6 1 1

output:

? 1 1
!
-6 

result:

ok ok, 1 queries

Test #3:

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

input:

1
-2 1 1

output:

? 1 1
!
-2 

result:

ok ok, 1 queries

Test #4:

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

input:

1
-6 1 1

output:

? 1 1
!
-6 

result:

ok ok, 1 queries

Test #5:

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

input:

1
-1 1 1

output:

? 1 1
!
-1 

result:

ok ok, 1 queries

Test #6:

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

input:

2
8 1 2
0 1 2

output:

? 1 1
? 2 2
!
8 0 

result:

ok ok, 2 queries

Test #7:

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

input:

2
-8 1 2
9 1 2

output:

? 1 1
? 2 2
!
-8 9 

result:

ok ok, 2 queries

Test #8:

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

input:

2
9 1 2
-10 1 2

output:

? 1 1
? 2 2
!
9 -10 

result:

ok ok, 2 queries

Test #9:

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

input:

2
-8 1 2
-5 1 2

output:

? 1 1
? 2 2
!
-8 -5 

result:

ok ok, 2 queries

Test #10:

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

input:

3
-7 1 2
-8 1 3
-8 3 3

output:

? 1 1
? 2 2
? 2 3
!
-7 -8 0 

result:

ok ok, 3 queries

Test #11:

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

input:

3
10 1 3
12 1 3
-6 2 2

output:

? 1 1
? 1 2
? 2 3
!
10 2 -8 

result:

ok ok, 3 queries

Test #12:

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

input:

3
-6 2 2
-16 1 3
-4 2 3

output:

? 1 1
? 1 2
? 2 3
!
-6 -10 6 

result:

ok ok, 3 queries

Test #13:

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

input:

3
-10 1 3
-19 3 3
-3 2 2

output:

? 1 1
? 1 2
? 2 3
!
-10 -9 6 

result:

ok ok, 3 queries

Test #14:

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

input:

4
8 1 3
13 1 4
11 2 4
10 3 3

output:

? 1 1
? 1 2
? 2 3
? 3 4
!
8 5 6 4 

result:

ok ok, 4 queries

Test #15:

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

input:

4
4 1 4
-2 2 4
-3 1 4
-11 3 3

output:

? 1 1
? 1 2
? 1 3
? 3 4
!
4 -6 -1 -10 

result:

ok ok, 4 queries

Test #16:

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

input:

4
8 2 2
11 2 3
14 2 4
11 2 4

output:

? 1 1
? 1 2
? 1 3
? 1 4
!
8 3 3 -3 

result:

ok ok, 4 queries

Test #17:

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

input:

4
5 1 4
-4 1 3
-14 4 4
-18 3 4

output:

? 1 1
? 1 2
? 2 3
? 2 4
!
5 -9 -5 -4 

result:

ok ok, 4 queries

Test #18:

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

input:

5
1 1 5
-1 1 3
2 2 5
11 3 4
6 5 5

output:

? 1 1
? 1 2
? 2 3
? 1 4
? 3 5
!
1 -2 4 8 -6 

result:

ok ok, 5 queries

Test #19:

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

input:

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

output:

? 1 1
? 1 2
? 1 3
? 1 4
? 4 5
!
6 3 -4 7 4 

result:

ok ok, 5 queries

Test #20:

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

input:

5
2 2 2
-7 2 3
2 2 4
-5 2 5
-1 2 4

output:

? 1 1
? 1 2
? 1 3
? 1 4
? 1 5
!
2 -9 9 -7 4 

result:

ok ok, 5 queries

Test #21:

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

input:

5
10 1 5
11 1 3
10 4 5
20 5 5
18 3 5

output:

? 1 1
? 1 2
? 2 3
? 1 4
? 2 5
!
10 1 9 0 8 

result:

ok ok, 5 queries

Test #22:

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

input:

7
-7 1 5
-4 1 4
-1 1 6
14 2 7
21 1 7
26 2 2
31 5 7

output:

? 1 1
? 1 2
? 1 3
? 2 4
? 2 5
? 2 6
? 3 7
!
-7 3 3 8 7 5 8 

result:

ok ok, 7 queries

Test #23:

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

input:

7
928760211 1 5
1140827340 1 4
1348258341 1 6
593880857 2 7
1365991699 1 7
1879666855 2 2
1819951459 5 7

output:

? 1 1
? 1 2
? 1 3
? 2 4
? 2 5
? 2 6
? 3 7
!
928760211 212067129 207431001 174382727 772110842 513675156 152351733 

result:

ok ok, 7 queries

Test #24:

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

input:

7
-13271 1 5
57730 1 4
18289 1 6
107781 2 7
47054 1 7
108776 2 2
125901 5 7

output:

? 1 1
? 1 2
? 1 3
? 2 4
? 2 5
? 2 6
? 3 7
!
-13271 71001 -39441 76221 -60727 61722 88126 

result:

ok ok, 7 queries

Test #25:

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

input:

7
-3 1 7
-11 2 7
-16 3 7
-22 4 7
-15 5 7
-5 1 7
18 6 6

output:

? 1 1
? 1 2
? 1 3
? 1 4
? 1 5
? 1 6
? 6 7
!
-3 -8 -5 -6 7 10 8 

result:

ok ok, 7 queries

Test #26:

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

input:

7
126470870 1 7
718294987 2 7
930105116 3 7
1833317789 4 7
2485241588 5 7
3087276705 1 7
896983714 6 6

output:

? 1 1
? 1 2
? 1 3
? 1 4
? 1 5
? 1 6
? 6 7
!
126470870 591824117 211810129 903212673 651923799 602035117 294948597 

result:

ok ok, 7 queries

Test #27:

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

input:

7
-15980 1 7
27954 2 7
77408 3 7
-14768 4 7
16826 5 7
59291 1 7
91862 6 6

output:

? 1 1
? 1 2
? 1 3
? 1 4
? 1 5
? 1 6
? 6 7
!
-15980 43934 49454 -92176 31594 42465 49397 

result:

ok ok, 7 queries

Test #28:

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

input:

7
1 6 6
-2 5 6
-10 4 6
-17 3 6
-10 2 6
-16 1 7
-17 4 7

output:

? 1 1
? 1 2
? 1 3
? 1 4
? 1 5
? 1 6
? 2 7
!
1 -3 -8 -7 7 -6 0 

result:

ok ok, 7 queries

Test #29:

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

input:

7
722629572 6 6
1694210676 5 6
2115432642 4 6
2240890591 3 6
2861009971 2 6
3061470466 1 7
2776386356 4 7

output:

? 1 1
? 1 2
? 1 3
? 1 4
? 1 5
? 1 6
? 2 7
!
722629572 971581104 421221966 125457949 620119380 200460495 437545462 

result:

ok ok, 7 queries

Test #30:

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

input:

7
6630 6 6
89822 5 6
173993 4 6
142281 3 6
120375 2 6
143582 1 7
118759 4 7

output:

? 1 1
? 1 2
? 1 3
? 1 4
? 1 5
? 1 6
? 2 7
!
6630 83192 84171 -31712 -21906 23207 -18193 

result:

ok ok, 7 queries

Test #31:

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

input:

7
-2 1 7
4 1 3
-2 4 7
-4 5 7
-14 3 7
-23 2 7
-9 7 7

output:

? 1 1
? 1 2
? 2 3
? 1 4
? 1 5
? 1 6
? 6 7
!
-2 6 -8 0 -10 -9 0 

result:

ok ok, 7 queries

Test #32:

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

input:

7
125372939 1 7
576711030 1 3
965321810 4 7
1739949935 5 7
2239882272 3 7
3027150770 2 7
1250760739 7 7

output:

? 1 1
? 1 2
? 2 3
? 1 4
? 1 5
? 1 6
? 6 7
!
125372939 451338091 513983719 649255186 499932337 787268498 463492241 

result:

ok ok, 7 queries

Test #33:

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

input:

7
3921 1 7
34728 1 3
29190 4 7
33003 5 7
-42403 3 7
41043 2 7
26523 7 7

output:

? 1 1
? 1 2
? 2 3
? 1 4
? 1 5
? 1 6
? 6 7
!
3921 30807 -1617 -108 -75406 83446 -56923 

result:

ok ok, 7 queries

Test #34:

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

input:

300
9 1 275
10 1 190
13 1 223
13 1 201
20 1 153
24 1 264
17 1 38
24 1 51
29 1 113
36 1 240
36 1 41
29 1 187
26 1 84
33 1 118
43 1 53
40 1 115
49 1 64
45 1 273
51 1 136
44 1 90
51 1 285
58 1 217
54 1 272
55 1 282
61 1 36
55 1 120
65 1 238
67 1 61
75 1 133
70 1 32
69 1 99
56 1 93
66 1 58
62 1 57
69 1 ...

output:

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

result:

ok ok, 300 queries

Test #35:

score: 0
Accepted
time: 7ms
memory: 3672kb

input:

300
446692687 1 275
818137368 1 190
1738654731 1 223
2091892239 1 201
3075188771 1 153
3187272620 1 264
3859465753 1 38
4160464754 1 51
4509115336 1 113
4779260110 1 240
5611055242 1 41
6460817064 1 187
7055404110 1 84
7860324023 1 118
8338226724 1 53
9027750522 1 115
9642248434 1 64
10451510966 1 2...

output:

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

result:

ok ok, 300 queries

Test #36:

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

input:

300
34137 1 275
117797 1 190
32337 1 223
79027 1 201
8769 1 153
61712 1 264
49941 1 38
31757 1 51
13909 1 113
18100 1 240
-81217 1 41
17737 1 187
-46126 1 84
-100031 1 118
-159278 1 53
-154800 1 115
-161783 1 64
-203691 1 273
-175874 1 136
-114202 1 90
-96202 1 285
-6084 1 217
33541 1 272
214 1 282
...

output:

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

result:

ok ok, 300 queries

Test #37:

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

input:

300
-8 1 300
2 2 300
5 3 300
-5 4 300
2 5 300
12 6 300
22 7 300
20 8 300
27 9 300
23 10 300
20 11 300
18 12 300
13 13 300
3 14 300
-2 15 300
-4 16 300
0 17 300
-4 18 300
-9 19 300
-3 20 300
-13 21 300
-3 22 300
-9 23 300
-7 24 300
-16 25 300
-8 26 300
-11 27 300
-13 28 300
-11 29 300
-18 30 300
-12 ...

output:

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

result:

ok ok, 300 queries

Test #38:

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

input:

300
544403347 1 300
1090572306 2 300
2015468797 3 300
2197536249 4 300
3149028362 5 300
3554504881 6 300
4369294878 7 300
4944975951 8 300
5802996466 9 300
6578874021 10 300
7426269797 11 300
8065431391 12 300
8524304068 13 300
9221203025 14 300
10217536160 15 300
10953708819 16 300
11278357271 17 3...

output:

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

result:

ok ok, 300 queries

Test #39:

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

input:

300
31429 1 300
-20336 2 300
-16901 3 300
61393 4 300
137636 5 300
50818 6 300
318 7 300
84036 8 300
106280 9 300
99888 10 300
88032 11 300
176648 12 300
131599 13 300
75179 14 300
66654 15 300
-10658 16 300
78738 17 300
19491 18 300
111479 19 300
187948 20 300
275757 21 300
364787 22 300
320180 23 ...

output:

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

result:

ok ok, 300 queries

Test #40:

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

input:

300
-3 122 122
-9 121 122
-14 122 123
-21 120 122
-14 122 124
-20 119 122
-14 122 125
-19 118 122
-11 122 126
-1 117 122
-8 122 127
-17 116 122
-20 122 128
-21 115 122
-25 122 129
-26 114 122
-23 122 130
-13 113 122
-7 122 131
0 112 122
6 122 132
7 111 122
-2 122 133
6 110 122
3 122 134
-5 109 122
-...

output:

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

result:

ok ok, 300 queries

Test #41:

score: 0
Accepted
time: 9ms
memory: 3592kb

input:

300
240562048 122 122
1166487995 121 122
2095763614 122 123
2400076344 120 122
3231381414 122 124
4135283312 119 122
4887637465 122 125
5532967901 118 122
6000358348 122 126
6675384015 117 122
6931795768 122 127
7360357133 116 122
7595132817 122 128
7890595484 115 122
8505359053 122 129
9083147865 1...

output:

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

result:

ok ok, 300 queries

Test #42:

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

input:

300
-91784 122 122
4067 121 122
96397 122 123
35154 120 122
3717 122 124
97642 119 122
33730 122 125
-9512 118 122
-92998 122 126
-109973 117 122
-59685 122 127
-35585 116 122
17676 122 128
75703 115 122
117901 122 129
133483 114 122
36218 122 130
-40367 113 122
-30031 122 131
61236 112 122
44172 12...

output:

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

result:

ok ok, 300 queries

Test #43:

score: 0
Accepted
time: 21ms
memory: 3656kb

input:

300
-7 1 300
-3 1 237
-11 238 300
-19 202 300
-11 1 201
-3 1 155
3 156 300
11 130 300
4 1 129
3 1 147
10 148 300
2 179 300
5 1 178
-4 1 113
-3 114 300
1 12 300
2 1 186
8 187 300
4 149 300
3 1 148
1 1 135
5 136 300
11 296 300
20 1 295
13 1 198
19 199 300
14 110 300
21 1 109
18 15 300
27 80 300
36 1 7...

output:

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

result:

ok ok, 300 queries

Test #44:

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

input:

300
543305416 1 300
948988350 1 237
1187675806 238 300
1320818481 202 300
2031936508 1 201
3024198367 1 155
3714116675 156 300
4224063766 130 300
4710889563 1 129
5686615302 1 147
5958627699 148 300
6176588836 179 300
6480682859 1 178
7274709238 1 113
8114487908 114 300
8943958290 12 300
9412142576 ...

output:

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

result:

ok ok, 300 queries

Test #45:

score: 0
Accepted
time: 11ms
memory: 3592kb

input:

300
-94493 1 300
-105206 1 237
-123982 238 300
-99442 202 300
-184379 1 201
-109712 1 155
-187035 156 300
-128374 130 300
-117589 1 129
-90969 1 147
-153221 148 300
-139458 179 300
-67383 1 178
-11871 1 113
81050 114 300
123201 12 300
122315 1 186
57252 187 300
106441 149 300
158326 1 148
90567 1 13...

output:

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

result:

ok ok, 300 queries

Test #46:

score: 0
Accepted
time: 41ms
memory: 4156kb

input:

10000
-3 1 4575
4 1 6425
-5 1 5525
-13 1 8999
-20 1 3086
-11 1 9945
-7 1 1938
-15 1 8199
-5 1 9822
4 1 1496
-6 1 3889
-2 1 1202
4 1 5954
0 1 1540
-2 1 7792
6 1 7823
6 1 9337
3 1 2545
9 1 1214
16 1 2488
18 1 5318
22 1 741
17 1 7257
17 1 273
26 1 6961
25 1 4942
20 1 9038
25 1 5558
31 1 1118
40 1 8693
...

output:

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

result:

ok ok, 10000 queries

Test #47:

score: 0
Accepted
time: 146ms
memory: 4116kb

input:

10000
154936337 1 4575
736917733 1 6425
1129643623 1 5525
1630181792 1 8999
2233128569 1 3086
2500318665 1 9945
2824642542 1 1938
2986692503 1 8199
3286087356 1 9822
3467108486 1 1496
4383206201 1 3889
5004959855 1 1202
5811899214 1 5954
6771767238 1 1540
7163927798 1 7792
7722995227 1 7823
81061785...

output:

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

result:

ok ok, 10000 queries

Test #48:

score: 0
Accepted
time: 106ms
memory: 4248kb

input:

10000
15092 1 4575
79125 1 6425
71980 1 5525
25497 1 8999
-69425 1 3086
-148097 1 9945
-177326 1 1938
-228243 1 8199
-210597 1 9822
-155312 1 1496
-194754 1 3889
-207725 1 1202
-175564 1 5954
-110525 1 1540
-26546 1 7792
-109454 1 7823
-38848 1 9337
28275 1 2545
81766 1 1214
76048 1 2488
51205 1 531...

output:

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

result:

ok ok, 10000 queries

Test #49:

score: 0
Accepted
time: 31ms
memory: 4264kb

input:

10000
-2 1 10000
-6 2 10000
-2 3 10000
-7 4 10000
-14 5 10000
-12 6 10000
-16 7 10000
-11 8 10000
-4 9 10000
-2 10 10000
-11 11 10000
-6 12 10000
-10 13 10000
-1 14 10000
2 15 10000
11 16 10000
9 17 10000
19 18 10000
15 19 10000
11 20 10000
13 21 10000
20 22 10000
29 23 10000
34 24 10000
28 25 10000...

output:

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

result:

ok ok, 10000 queries

Test #50:

score: 0
Accepted
time: 49ms
memory: 4240kb

input:

10000
546062330 1 10000
1507800714 2 10000
1904905732 3 10000
2234273845 4 10000
3010448913 5 10000
3571031679 6 10000
4037952420 7 10000
4269651745 8 10000
5078416531 9 10000
5560137732 10 10000
5796868799 11 10000
6501437558 12 10000
7172662548 13 10000
8024509616 14 10000
8935100610 15 10000
9335...

output:

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

result:

ok ok, 10000 queries

Test #51:

score: 0
Accepted
time: 83ms
memory: 4120kb

input:

10000
12383 1 10000
-30148 2 10000
-94219 3 10000
-109099 4 10000
-57521 5 10000
-155450 6 10000
-223409 7 10000
-226603 8 10000
-168865 9 10000
-124164 10 10000
-130323 11 10000
-207810 12 10000
-302657 13 10000
-323173 14 10000
-388472 15 10000
-298990 16 10000
-240362 17 10000
-336400 18 10000
-4...

output:

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

result:

ok ok, 10000 queries

Test #52:

score: 0
Accepted
time: 45ms
memory: 4188kb

input:

10000
2 522 522
7 521 522
3 522 523
5 520 522
-1 522 524
6 519 522
-2 522 525
4 518 522
-4 522 526
-5 517 522
-1 522 527
6 516 522
8 522 528
17 515 522
25 522 529
31 514 522
24 522 530
30 513 522
40 522 531
41 512 522
42 522 532
36 511 522
43 522 533
50 510 522
58 522 534
59 509 522
63 522 535
55 50...

output:

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

result:

ok ok, 10000 queries

Test #53:

score: 0
Accepted
time: 117ms
memory: 4260kb

input:

10000
848805698 522 522
1290301069 521 522
1896817924 522 523
2348431315 520 522
3004419340 522 524
3858394776 519 522
4556295006 522 525
4857643694 518 522
5480811121 522 526
5861680435 517 522
6114012147 522 527
6607980678 516 522
7260141383 522 528
7710552161 515 522
8034540879 522 529
8481873321...

output:

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

result:

ok ok, 10000 queries

Test #54:

score: 0
Accepted
time: 108ms
memory: 4260kb

input:

10000
9674 522 522
-59924 521 522
-89279 522 523
-43694 520 522
-45616 522 524
37198 519 522
-44172 522 525
-120147 518 522
-168139 522 526
-254525 517 522
-173223 522 527
-206869 516 522
-257584 522 528
-280614 515 522
-295191 522 529
-258637 514 522
-278313 522 530
-337510 513 522
-355679 522 531
...

output:

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

result:

ok ok, 10000 queries

Test #55:

score: 0
Accepted
time: 69ms
memory: 4204kb

input:

10000
6 1 10000
16 1 8598
26 8599 10000
27 9331 10000
21 1 9330
12 1 9758
21 9759 10000
18 130 10000
8 1 129
9 1 3768
14 3769 10000
22 1552 10000
26 1 1551
23 1 6223
16 6224 10000
23 3876 10000
23 1 3875
13 1 8573
13 8574 10000
10 6439 10000
3 1 6438
8 1 5015
12 5016 10000
20 2529 10000
20 1 2528
22...

output:

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

result:

ok ok, 10000 queries

Test #56:

score: 0
Accepted
time: 78ms
memory: 4188kb

input:

10000
339931690 1 10000
956151339 1 8598
1655429946 8599 10000
1935873282 9331 10000
2266641555 1 9330
2807424993 1 9758
3442889379 9759 10000
4215439389 130 10000
4447976748 1 129
5129546134 1 3768
5602511199 3769 10000
5885879501 1552 10000
6402325837 1 1551
6656333035 1 6223
7205336855 6224 10000...

output:

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

result:

ok ok, 10000 queries

Test #57:

score: 0
Accepted
time: 155ms
memory: 4244kb

input:

10000
32283 1 10000
56122 1 8598
115662 8599 10000
192851 9331 10000
137429 1 9330
80481 1 9758
160383 9759 10000
132131 130 10000
178410 1 129
81440 1 3768
104382 3769 10000
6220 1552 10000
28498 1 1551
-51226 1 6223
-69259 6224 10000
-60316 3876 10000
-37792 1 3875
-85467 1 8573
-185288 8574 10000...

output:

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

result:

ok ok, 10000 queries