QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#422818#8086. CloysterAfterlife#AC ✓29ms19408kbC++203.4kb2024-05-27 19:35:352024-05-27 19:35:36

Judging History

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

  • [2024-05-27 19:35:36]
  • 评测
  • 测评结果:AC
  • 用时:29ms
  • 内存:19408kb
  • [2024-05-27 19:35:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int n ;
int a[2005][2005];
int m = -1, m_x , m_y;
typedef pair<int,int> pii;
// namespace Q{
//     int a[2005][2005];
//     int n , x , y;
//     // mt19937 rnd(1);
//     void init() {
//         int zz ;cin >> n >> zz ;
//         mt19937 rnd(zz);
//         memset(a,-1,sizeof(a));
//         x = rnd()%n + 1 , y = rnd()%n + 1;
//         a[x][y] = n * n ;
//         set<pii> st;
//         auto span = [&](int x,int y) {
//             for(int i = -1;i <= 1;i++) {
//                 for(int j = -1;j <= 1;j++) {
//                     if(1 <= x + i && x + i <= n && 1 <= y + j && y + j <= n && a[i+x][j+y] == -1) st.insert({i+x , j+y}) ;
//                 }
//             }
//         };
//         span(x , y) ;;
//         for(int i = n * n - 1; i >= 1;i--) {
//             vector<pii> vec(st.begin() , st.end()) ;
//             auto [u,v] = vec[rnd()%vec.size()] ;
//             a[u][v] = i;
//             st.erase({u,v});
//             span(u , v);
//         }
//     }
//     int qry(int x,int y) {
//         return a[x][y] ;
//     }
//     void report(int xx,int yy) {
//         if(x == xx && y == yy) {
//             printf("OK\n");
//         }
//         else {
//             printf("BAD %d %d : %d %d\n",x,y,xx,yy) ;
//             for(int i = 1;i <= n;i++ , printf("\n")) for(int j= 1;j <= n;j++) printf("%d ",a[i][j]);
//         }
//     }
// };
int qry(int x,int y) {
    if(a[x][y] != -1) return a[x][y] ;
    int g;
    cout<< "? " << x <<' ' << y << endl;
    cin >> g;
    // g = Q::qry(x,y);
    if(g > m) {
        m = g ; m_x =x;m_y = y;
    }
    return (a[x][y] = g);
}
void report() {
    // Q::report(m_x , m_y);
    cout << "! " << m_x <<' '<< m_y << endl ;
    return ;
}
void qe(int x,int y) {
    for(int i = -1;i <= 1;i++) {
        for(int j = -1;j <= 1;j++) {
            if(1 <= x + i && x + i <= n && 1 <= y + j && y + j <= n) qry(x+i , y+j) ;
        }
    }
}
void solve(int xl,int xr,int yl,int yr) {
    // printf("Q %d %d %d %d\n",xl,xr,yl,yr);
    if(xl == xr && yl == yr) {
        // Q::report(xl,xr) ;
        cout << "! " << xl <<' ' << yl << endl ; return ;
    }
    if(xr - xl > yr - yl) {
        int mx = 0 , ypos;
        int md = (xl + xr) >> 1;
        for(int i = yl ; i <= yr;i++) {
            if(qry(md , i) > mx) {
                mx = qry(md , i) ;
                ypos = i;
            }
        }
        qe(md , ypos) ;
        if(m_x < md) solve(xl , md - 1 , yl , yr);
        else if(m_x > md) solve(md + 1 , xr , yl , yr);
        else {
            report() ; return ;
        }
    }
    else {
        int mx = 0 , xpos ;
        int md = (yl + yr) >> 1;
        for(int i = xl ; i <= xr;i++) {
            if(qry(i , md) > mx) {
                mx = qry(i , md) ;
                xpos = i;
            }
        }
        qe(xpos , md) ;
        if(m_y < md) solve(xl , xr , yl , md - 1);
        else if(m_y > md) solve(xl , xr , md + 1 , yr) ;
        else {
            report() ; return ;
        }
    }
}
void solv() {
    cin >> n;
    // n = Q::n ;
    solve(1 , n , 1 , n);
}
int main() {
    // freopen("in.txt","r",stdin); 
    ios::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
    memset(a,-1,sizeof(a));
    int t = 1;
    // Q::init() ;
    while(t--) solv() ;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 4ms
memory: 19388kb

input:

3
2
5
8
7
4
6
9
3

output:

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

result:

ok used 8 queries (allowed: 219)

Test #2:

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

input:

5
31
19
11
3
67
5
2
71
61
83
13
89
23
79
97
29

output:

? 1 3
? 2 3
? 3 3
? 4 3
? 5 3
? 4 2
? 4 4
? 5 2
? 5 4
? 3 1
? 3 2
? 2 1
? 2 2
? 4 1
? 1 1
? 1 2
! 1 1

result:

ok used 16 queries (allowed: 225)

Test #3:

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

input:

2
100
250
200
300

output:

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

result:

ok used 4 queries (allowed: 216)

Test #4:

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

input:

2
20
30
40
10

output:

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

result:

ok used 4 queries (allowed: 216)

Test #5:

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

input:

5
52
67
74
71
60
66
68
73
69
72
70

output:

? 1 3
? 2 3
? 3 3
? 4 3
? 5 3
? 2 2
? 2 4
? 3 2
? 3 4
? 4 2
? 4 4
! 3 3

result:

ok used 11 queries (allowed: 225)

Test #6:

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

input:

5
62
17
72
27
75
80
73
31
33
70
21
15
66
25
76

output:

? 1 3
? 2 3
? 3 3
? 4 3
? 5 3
? 4 2
? 4 4
? 5 2
? 5 4
? 3 1
? 3 2
? 2 1
? 2 2
? 4 1
? 5 1
! 4 2

result:

ok used 15 queries (allowed: 225)

Test #7:

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

input:

5
26
8
10
4
32
5
1
33
31
6
35
36
7
34
37
9

output:

? 1 3
? 2 3
? 3 3
? 4 3
? 5 3
? 4 2
? 4 4
? 5 2
? 5 4
? 3 1
? 3 2
? 2 1
? 2 2
? 4 1
? 1 1
? 1 2
! 1 1

result:

ok used 16 queries (allowed: 225)

Test #8:

score: 0
Accepted
time: 13ms
memory: 19328kb

input:

2000
76373770
77749270
78801520
79886770
77938520
78378270
81124271
80415271
81310521
81740021
82035021
82131021
82352771
79450020
83042271
83633021
83895771
83996771
81395271
83893271
86040272
86254772
81996521
85861022
86144272
88777523
87730522
88878773
89092023
87930522
82974771
89297023
8988127...

output:

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

result:

ok used 6081 queries (allowed: 6210)

Test #9:

score: 0
Accepted
time: 15ms
memory: 19284kb

input:

2000
791079313
790778785
791674870
793082438
793397488
793717951
794066166
795199343
794183237
786740986
786334211
783797805
793486844
794756215
794698333
793186925
788298881
793006693
792771488
793012719
791114255
783818025
790929264
789993541
790575212
788668141
791974558
790113095
791698278
79178...

output:

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

result:

ok used 6078 queries (allowed: 6210)

Test #10:

score: 0
Accepted
time: 17ms
memory: 19288kb

input:

1999
134234919
134132679
134376990
135044156
135394318
135451835
133183325
135085145
134471429
134979391
134184802
135136494
135221126
133758056
135063251
135227896
134833222
135263724
134540815
135086410
134775229
135208841
135375757
135454070
135209881
134897340
135199578
135490569
134918436
13394...

output:

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

result:

ok used 6067 queries (allowed: 6207)

Test #11:

score: 0
Accepted
time: 10ms
memory: 19356kb

input:

2000
2794895
223255
2630039
464380
1743156
2798776
764730
225481
2801818
2802205
1384239
2115278
2797223
1452035
2802198
2323122
2149732
1757184
1747125
831834
12908
2808508
2806684
759756
2280814
1050899
2331210
2809128
780562
1657711
2473444
2814543
548831
205014
996824
2814881
2647372
2810870
114...

output:

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

result:

ok used 6092 queries (allowed: 6210)

Test #12:

score: 0
Accepted
time: 18ms
memory: 19356kb

input:

2000
5025716
8600299
8605754
8607467
5173976
4529491
8597744
8597267
6298116
8629304
5990669
4254841
8643349
8646239
4301651
4509854
5723996
8654622
8662387
1138363
2966501
3295768
4192429
4075236
8674522
5854276
5749294
8687394
3373194
6317661
4863706
8693229
6152521
4860436
4527004
8706827
5540624...

output:

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

result:

ok used 6074 queries (allowed: 6210)

Test #13:

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

input:

1999
43950372
46403333
46535993
40148629
47881609
45998054
47893932
47894792
47888712
44780962
41676434
38947435
47078368
34256339
47911181
39667483
47907313
45494474
46706535
42637095
47914687
46497844
47923437
47930491
46033701
47931786
45733415
40347413
47928557
47323874
47943945
46199647
4708295...

output:

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

result:

ok used 6066 queries (allowed: 6207)

Test #14:

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

input:

1999
142105
4148897
2106003
142159
3547473
142165
142164
142176
142177
142183
3547447
142181
3547449
3547451
142193
142235
142237
4148694
142245
142242
2607200
2607201
2106199
2106197
4148630
2106253
2106252
2106251
4148626
141796
2106243
2106238
2106239
4148621
142031
3546962
3546985
141800
3546983...

output:

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

result:

ok used 2005 queries (allowed: 6207)

Test #15:

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

input:

2000
998729546
999784145
998208547
999784147
998208474
998209023
999784150
999784151
998209026
998209027
999784154
998209030
998209035
999159386
999159472
998208962
998208963
998208965
998208925
998208924
999159478
999159479
998208922
999159487
998208948
998208947
999159484
999159481
998208944
99978...

output:

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

result:

ok used 6071 queries (allowed: 6210)

Test #16:

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

input:

2000
155324
157143
4261229
157082
157083
157080
4261225
4261224
157088
157102
157101
2410022
155488
2410007
155490
155482
2410033
2410034
155494
155495
2410057
2410036
155498
2410050
156911
2410092
156666
156667
156668
156678
2409896
2409897
2409898
156613
156611
156610
156702
156701
2409877
156426
...

output:

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

result:

ok used 6077 queries (allowed: 6210)

Test #17:

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

input:

2000
3513651
3907434
3513652
865734
3907413
865896
865897
865899
3907409
3907408
865567
3907390
865572
4161269
865574
4161271
866342
866331
866332
3907333
866330
3907348
865331
865381
865380
865383
3907327
3907326
865053
865057
865054
865055
3907362
1125570
3513854
1125562
3513855
1125566
3513676
39...

output:

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

result:

ok used 6078 queries (allowed: 6210)

Test #18:

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

input:

2000
7980915
22233834
7980895
7980969
7980774
49675197
7980953
49675578
7980769
49675620
8811599
25383109
25383128
25383140
25383149
25383150
25383090
8817824
25385128
8817098
8817100
8817112
25385155
25385186
25385219
25385271
25385255
8817250
8817269
25385521
8817287
25384049
8817302
8817320
88173...

output:

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

result:

ok used 6078 queries (allowed: 6210)

Test #19:

score: 0
Accepted
time: 16ms
memory: 19280kb

input:

2000
2932490
542658
2932495
542656
542655
542653
2932481
500726
2928900
4054916
500846
500893
2928929
4054870
500903
500904
500905
500906
4054863
500709
500708
4054860
500704
3195941
4054849
545583
4054851
543915
543916
2933581
2933582
2933583
2933585
544117
544119
544120
544121
545015
545014
405375...

output:

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

result:

ok used 6047 queries (allowed: 6210)

Test #20:

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

input:

250
24963
25365
25502
25903
26124
26421
26734
26899
27351
27433
27878
28064
28477
28655
29087
29430
29848
30114
30489
30517
31129
31145
31569
31924
32426
32757
33070
33269
33634
33863
34294
34614
35109
35282
35672
36150
36477
36618
36968
37349
37636
37911
38190
38700
38867
39326
39729
40002
40216
40...

output:

? 1 125
? 2 125
? 3 125
? 4 125
? 5 125
? 6 125
? 7 125
? 8 125
? 9 125
? 10 125
? 11 125
? 12 125
? 13 125
? 14 125
? 15 125
? 16 125
? 17 125
? 18 125
? 19 125
? 20 125
? 21 125
? 22 125
? 23 125
? 24 125
? 25 125
? 26 125
? 27 125
? 28 125
? 29 125
? 30 125
? 31 125
? 32 125
? 33 125
? 34 125
? 3...

result:

ok used 789 queries (allowed: 960)

Test #21:

score: 0
Accepted
time: 8ms
memory: 19288kb

input:

1999
87564764
87567657
87567964
87569625
87571910
87573509
87573564
87575187
87577770
87578110
87579356
87581287
87582835
87645482
75121085
87711165
75068962
87778459
75004701
87843953
74945808
87907497
74907786
87972099
74853983
88036712
74775845
88101043
74729864
88164474
74656680
88226318
7461038...

output:

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

result:

ok used 6011 queries (allowed: 6207)

Test #22:

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

input:

2000
954806520
954813311
954823382
954830601
954841918
954860112
954867008
954877515
954883987
954897234
954902061
954913386
954918962
954928095
954938406
954956141
954961839
954968551
954979790
954994706
955000439
955008427
955016205
955028940
955039183
955045894
955052914
955064062
955073421
95507...

output:

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

result:

ok used 6068 queries (allowed: 6210)

Test #23:

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

input:

2000
209355176
209733888
209977573
210230443
210545625
210775132
211076718
211457448
211535940
212013592
212166736
212552459
212864383
212902608
213381945
213701073
213797275
214050581
214507923
214857070
215121751
215480387
215594897
215825477
216268444
216483664
216917664
216993282
217545630
21778...

output:

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

result:

ok used 6067 queries (allowed: 6210)

Test #24:

score: 0
Accepted
time: 8ms
memory: 19284kb

input:

2000
45418490
253905139
45312315
254287338
45144654
254668288
45077152
255047987
44934882
255426436
44802768
255803635
44677296
256179583
44485493
256554282
44381349
256927731
44223923
257299930
44131889
257670879
43985790
258040578
43843364
258409026
43724767
258776225
43582106
259142174
43437961
2...

output:

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

result:

ok used 6068 queries (allowed: 6210)

Test #25:

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

input:

1999
29065540
29094707
29125388
29149900
29161574
29187012
29212975
29243856
29266504
29276063
29316204
29342718
29347497
29374712
29395933
29432057
29443981
29467054
29489489
29527252
29543206
29566754
29598311
29611687
29655856
29679229
29691404
29710323
29735123
29761949
29791028
29818506
2982876...

output:

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

result:

ok used 6070 queries (allowed: 6207)

Test #26:

score: 0
Accepted
time: 29ms
memory: 19280kb

input:

2000
884673717
263860391
263571176
263254575
886020394
262555275
262041050
261685382
887367168
261081026
260730379
260457043
888688971
259741471
259140294
258817424
890022238
258071129
257729813
257456013
891345056
256604043
256163090
256066640
892644198
255263780
254951431
254339530
893973972
25372...

output:

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

result:

ok used 6068 queries (allowed: 6210)

Test #27:

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

input:

2000
531369883
531449883
531532383
531582133
531678383
531770383
531828133
531894383
531974883
532015383
532089883
532208383
532227383
532305383
532425633
532482383
532543133
532609133
532646633
532734633
532810883
532891383
532910883
532972133
533035633
533106383
533198383
533246383
533329633
53336...

output:

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

result:

ok used 6027 queries (allowed: 6210)

Test #28:

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

input:

1999
18472451
18490859
18503117
18523692
18543553
18572253
18593583
18610352
18620782
18658237
18669050
18701292
18703647
18741643
18750345
18783834
18802909
18811723
18834472
18871693
18883836
18901593
18933829
18938407
18963398
18980812
19018041
19039630
19046586
19070830
19102931
19111694
1914936...

output:

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

result:

ok used 6065 queries (allowed: 6207)

Test #29:

score: 0
Accepted
time: 18ms
memory: 19280kb

input:

2000
524309355
524551515
524950855
525340365
602806270
140586211
140377865
140219741
140128967
139813368
139654109
139622476
605854754
139164384
139020728
138914471
138769792
138589863
138447730
138147748
608829982
137875677
137720587
137447545
137326603
137153776
136947756
136812356
611848879
13649...

output:

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

result:

ok used 6060 queries (allowed: 6210)

Test #30:

score: 0
Accepted
time: 15ms
memory: 19284kb

input:

2000
541525722
541882718
542428007
543000222
543508660
543962674
544353976
545215427
545589350
546313972
546816297
547002352
547378138
548282973
548467039
549030704
549666684
550312147
550542248
551324793
551639544
552182137
552425987
553176971
553474858
553974636
554787273
555114358
555782280
55626...

output:

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

result:

ok used 6069 queries (allowed: 6210)

Test #31:

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

input:

2000
3997000
3997001
3997002
3997003
3997004
3997005
3997006
3997007
3997008
3997009
3997010
3997011
3997012
3997013
3997014
3997015
3997016
3997017
3997018
3997019
3997020
3997021
3997022
3997023
3997024
3997025
3997026
3997027
3997028
3997029
3997030
3997031
3997032
3997033
3997034
3997035
3997036...

output:

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

result:

ok used 6077 queries (allowed: 6210)

Test #32:

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

input:

2000
3996805
3992827
3990849
3988871
3986893
3984915
3982937
3980959
3978981
3977003
3975025
3973047
3971069
3969091
3967113
3965135
3963134
3961146
3959158
3957170
3955180
3953191
3951201
3949213
3947220
3945227
3943234
3941241
3939248
3937255
3935262
3933284
3931290
3929296
3927302
3925308
3923314...

output:

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

result:

ok used 6040 queries (allowed: 6210)

Test #33:

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

input:

2000
2997999
2998000
2998001
2998002
2998003
2998004
2998005
2998006
2998007
2998008
2998009
2998010
2998011
2998012
2998013
2998014
2998015
2998016
2998017
2998018
2998019
2998020
2998021
2998022
2998023
2998024
2998025
2998026
2998027
2998028
2998029
2998030
2998031
2998032
2998033
2998034
2998035...

output:

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

result:

ok used 6070 queries (allowed: 6210)

Test #34:

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

input:

2000
3997668
3994440
3992462
3990484
3988506
3986528
3984550
3982572
3980563
3978578
3976593
3974608
3972615
3970626
3968635
3966657
3964663
3962669
3960675
3958681
3956687
3954693
3952699
3950705
3948711
3946717
3944723
3942729
3940735
3938741
3936747
3934784
3932789
3930794
3928799
3926804
3924809...

output:

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

result:

ok used 6001 queries (allowed: 6210)

Test #35:

score: 0
Accepted
time: 8ms
memory: 19348kb

input:

2000
249534570
338240624
113419206
338240949
338241807
338242096
113415063
113415057
113420116
113420113
237652843
237660289
338192739
663800
659057
338195598
113384270
113346797
113346814
249523987
113346059
249525391
249525498
249525984
249526024
113345949
249526490
113345115
113345126
113355659
3...

output:

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

result:

ok used 6067 queries (allowed: 6210)

Test #36:

score: 0
Accepted
time: 15ms
memory: 19352kb

input:

2000
119955546
120001233
120001231
120001147
86532262
86532138
86532129
86531976
120000892
86531719
66413572
66413703
66413809
119974424
66415569
66415573
66415804
120000093
66416287
66416262
119974289
86515105
119973516
119973407
86514788
541771333
86474701
86474576
132199550
132200554
86474395
864...

output:

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

result:

ok used 6081 queries (allowed: 6210)

Test #37:

score: 0
Accepted
time: 16ms
memory: 19344kb

input:

2000
86301854
382156252
86597399
86597208
86597155
86596697
199557889
86597101
86586793
86587237
86587340
86587387
86586771
86587911
86587650
199559858
199555966
86588670
382204698
86610150
138191327
138191395
138191595
138191611
138191619
86305346
86585601
382219799
86585277
86585257
86584869
86584...

output:

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

result:

ok used 6075 queries (allowed: 6210)

Test #38:

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

input:

2000
150299340
9626336
9625586
151326763
9625036
9625164
9713747
151325366
9713754
9713856
9624810
150198595
75984351
150201895
75984126
75984119
75984055
75983997
75983991
150199578
75974165
75974179
75973939
343189123
75973163
151335277
151343278
75982646
75982604
75982593
151346465
151346512
7598...

output:

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

result:

ok used 6090 queries (allowed: 6210)

Test #39:

score: 0
Accepted
time: 15ms
memory: 19396kb

input:

2000
217960041
26676813
217962788
26677111
217962965
217963178
26099511
26098968
217963257
26674394
26674381
219730665
26667136
26667112
219573187
26667034
219561894
26671713
219555518
219555709
219555461
26671185
219481429
219577625
26669242
26669167
219490802
26663427
26663407
26663404
26662589
21...

output:

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

result:

ok used 6068 queries (allowed: 6210)

Test #40:

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

input:

2000
112314491
112314476
499669781
112314407
120613850
499652944
112313931
112313997
499652216
112313611
112313610
112313524
112313321
274528302
274529627
112316389
112316492
500042459
112267174
120610123
112266953
112266976
500130499
112022995
259563199
259563825
112255851
259564517
112255304
25956...

output:

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

result:

ok used 6078 queries (allowed: 6210)

Test #41:

score: 0
Accepted
time: 10ms
memory: 19328kb

input:

2000
111153813
111153870
256357424
111154834
111154732
256353478
111154662
111154450
111156159
111165499
111165414
256375980
111165361
111156615
256376226
111157249
111156689
111156681
111156655
111164174
111164316
256380393
111176006
111174384
254578744
254578626
111175561
256398700
111175197
11117...

output:

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

result:

ok used 6077 queries (allowed: 6210)

Test #42:

score: 0
Accepted
time: 13ms
memory: 19348kb

input:

2000
390216292
48930393
48928364
136220637
48946835
136216104
136216130
136216223
48946356
136221877
48946499
48946286
48946229
48871999
390655788
48945759
134483915
48944051
48944072
48882839
48882965
48883012
134484481
53061994
53062048
53062102
134487545
134487553
134487764
48884278
48884315
1344...

output:

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

result:

ok used 6086 queries (allowed: 6210)