QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#296970#2727. Gradient DescentCamillus#15 1ms3728kbC++201.1kb2024-01-03 20:37:542024-07-04 03:16:38

Judging History

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

  • [2024-07-04 03:16:38]
  • 评测
  • 测评结果:15
  • 用时:1ms
  • 内存:3728kb
  • [2024-01-03 20:37:54]
  • 提交

answer

/// @author Camillus <3
#ifndef LOCAL
#define debug(...) 42
#endif
#include "bits/stdc++.h"
using namespace std;

int query(int x, int y) {
    cout << "? " << x << " " << y << endl;
    int result;
    cin >> result;
    return result;
}

int answer(int s) {
    cout << "! " << s << endl;
    exit(0);
}


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int R, C, L;
    cin >> R >> C >> L;

    int x, y;

    if (query(0, 0) <= query(0, 1)) {
        y = 0;
    } else {
        int l = 0, r = C;
        while (r - l > 1) {
            int m = (l + r) / 2;
            if (query(0, m) > query(0, m + 1)) {
                l = m;
            } else {
                r = m;
            }
        }
        y = r;
    }

    if (query(0, 0) <= query(1, 0)) {
        x = 0;
    } else {
        int l = 0, r = C;
        while (r - l > 1) {
            int m = (l + r) / 2;
            if (query(m, 0) > query(m + 1, 0)) {
                l = m;
            } else {
                r = m;
            }
        }
        x = r;
    }

    answer(query(x, y));
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 3708kb

input:

1 90 90
7500
7400
3000
2900
800
700
500
600
300
200
200
300
200
100
100
200
7500
7400
11800
11900
9500
9600
8400
8500
7800
7900
7500
7600
7400
7500
0

output:

? 0 0
? 0 1
? 0 45
? 0 46
? 0 67
? 0 68
? 0 78
? 0 79
? 0 72
? 0 73
? 0 75
? 0 76
? 0 73
? 0 74
? 0 74
? 0 75
? 0 0
? 1 0
? 45 0
? 46 0
? 22 0
? 23 0
? 11 0
? 12 0
? 5 0
? 6 0
? 2 0
? 3 0
? 1 0
? 2 0
? 1 74
! 0

result:

ok Solution answered 0 ans asked 31 questions

Test #2:

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

input:

1 90 90
4950
4851
2341
2332
2569
2606
2334
2343
2318
2317
2319
2324
2317
2318
4950
4851
9207
9306
6930
7029
5841
5940
5247
5346
4950
5049
4851
4950
2218

output:

? 0 0
? 0 1
? 0 45
? 0 46
? 0 67
? 0 68
? 0 56
? 0 57
? 0 50
? 0 51
? 0 53
? 0 54
? 0 51
? 0 52
? 0 0
? 1 0
? 45 0
? 46 0
? 22 0
? 23 0
? 11 0
? 12 0
? 5 0
? 6 0
? 2 0
? 3 0
? 1 0
? 2 0
? 1 51
! 2218

result:

ok Solution answered 2218 ans asked 29 questions

Test #3:

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

input:

1 90 90
4990
4890
2412
2392
2528
2570
2306
2306
2338
2326
2314
2310
2310
2308
2308
2306
4990
4890
9290
9390
6990
7090
5890
5990
5290
5390
4990
5090
4890
4990
2206

output:

? 0 0
? 0 1
? 0 45
? 0 46
? 0 67
? 0 68
? 0 56
? 0 57
? 0 50
? 0 51
? 0 53
? 0 54
? 0 54
? 0 55
? 0 55
? 0 56
? 0 0
? 1 0
? 45 0
? 46 0
? 22 0
? 23 0
? 11 0
? 12 0
? 5 0
? 6 0
? 2 0
? 3 0
? 1 0
? 2 0
? 1 56
! 2206

result:

ok Solution answered 2206 ans asked 31 questions

Test #4:

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

input:

1 60 90
3233
3134
1467
1462
1774
1829
1500
1523
1456
1459
1462
1457
1457
1456
3233
3134
6005
6104
4520
4619
3728
3827
3332
3431
3134
3233
1357

output:

? 0 0
? 0 1
? 0 30
? 0 31
? 0 45
? 0 46
? 0 37
? 0 38
? 0 33
? 0 34
? 0 31
? 0 32
? 0 32
? 0 33
? 0 0
? 1 0
? 30 0
? 31 0
? 15 0
? 16 0
? 7 0
? 8 0
? 3 0
? 4 0
? 1 0
? 2 0
? 1 33
! 1357

result:

ok Solution answered 1357 ans asked 27 questions

Test #5:

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

input:

1 60 90
3118
3018
1510
1510
2020
1964
1686
1646
1556
1532
1518
1514
1514
1510
3118
3018
5918
6018
4418
4518
3618
3718
3218
3318
3018
3118
1410

output:

? 0 0
? 0 1
? 0 30
? 0 31
? 0 15
? 0 16
? 0 22
? 0 23
? 0 26
? 0 27
? 0 28
? 0 29
? 0 29
? 0 30
? 0 0
? 1 0
? 30 0
? 31 0
? 15 0
? 16 0
? 7 0
? 8 0
? 3 0
? 4 0
? 1 0
? 2 0
? 1 30
! 1410

result:

ok Solution answered 1410 ans asked 27 questions

Subtask #2:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 1ms
memory: 3596kb

input:

1 10000000 90
815667200
815667100
315667200
315667100
65667200
65667100
59333000
59333100
3167200
3167100
28083000
28083100
12458000
12458100
4645500
4645600
739200
739300
1214100
1214000
237600
237500
250900
251000
6700
6800
115600
115500
54600
54500
24100
24000
8800
8700
1200
1100
2800
2900
900
10...

output:

? 0 0
? 0 1
? 0 5000000
? 0 5000001
? 0 7500000
? 0 7500001
? 0 8750000
? 0 8750001
? 0 8125000
? 0 8125001
? 0 8437500
? 0 8437501
? 0 8281250
? 0 8281251
? 0 8203125
? 0 8203126
? 0 8164062
? 0 8164063
? 0 8144531
? 0 8144532
? 0 8154296
? 0 8154297
? 0 8159179
? 0 8159180
? 0 8156737
? 0 8156738
...

result:

wrong answer Query Limit Exceeded!

Subtask #3:

score: 5
Accepted

Test #11:

score: 5
Accepted
time: 1ms
memory: 3656kb

input:

10000000 10000000 170
951301000
951300900
451301000
451300900
201301000
201300900
194966800
194966900
138801000
138800900
163716800
163716900
148091800
148091900
140279300
140279400
136373000
136373100
136847900
136847800
135871400
135871300
135884700
135884800
135640500
135640600
135749400
13574930...

output:

? 0 0
? 0 1
? 0 5000000
? 0 5000001
? 0 7500000
? 0 7500001
? 0 8750000
? 0 8750001
? 0 8125000
? 0 8125001
? 0 8437500
? 0 8437501
? 0 8281250
? 0 8281251
? 0 8203125
? 0 8203126
? 0 8164062
? 0 8164063
? 0 8144531
? 0 8144532
? 0 8154296
? 0 8154297
? 0 8159179
? 0 8159180
? 0 8156737
? 0 8156738
...

result:

ok Solution answered 0 ans asked 97 questions

Test #12:

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

input:

10000000 10000000 170
1040046173
1040046074
797877949
797877944
831857269
831857298
803881051
803881070
798328787
798328792
797157713
797157712
797619975
797619978
797385600
797385603
797268411
797268414
797209818
797209821
797180520
797180523
797165871
797165874
797158548
797158551
797156493
797156...

output:

? 0 0
? 0 1
? 0 5000000
? 0 5000001
? 0 7500000
? 0 7500001
? 0 6250000
? 0 6250001
? 0 5625000
? 0 5625001
? 0 5312500
? 0 5312501
? 0 5468750
? 0 5468751
? 0 5390625
? 0 5390626
? 0 5351562
? 0 5351563
? 0 5332031
? 0 5332032
? 0 5322265
? 0 5322266
? 0 5317382
? 0 5317383
? 0 5314941
? 0 5314942
...

result:

ok Solution answered 493034338 ans asked 97 questions

Test #13:

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

input:

10000000 10000000 170
1005336219
1005336119
749920151
749920159
799944869
799944821
754790883
754790861
746928661
746928659
747757751
747757755
747132751
747132755
746915535
746915537
746850537
746850535
746876471
746876473
746856939
746856941
746847173
746847175
746845655
746845653
746844731
746844...

output:

? 0 0
? 0 1
? 0 5000000
? 0 5000001
? 0 2500000
? 0 2500001
? 0 3750000
? 0 3750001
? 0 4375000
? 0 4375001
? 0 4687500
? 0 4687501
? 0 4531250
? 0 4531251
? 0 4453125
? 0 4453126
? 0 4414062
? 0 4414063
? 0 4433593
? 0 4433594
? 0 4423827
? 0 4423828
? 0 4418944
? 0 4418945
? 0 4416503
? 0 4416504
...

result:

ok Solution answered 471261661 ans asked 97 questions

Test #14:

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

input:

5000000 6666666 170
527730925
527730826
407280398
407280421
407951529
407951494
396784608
396784613
398488673
398488660
397430088
397430083
396909253
396909248
396648838
396648833
396654398
396654403
396589293
396589298
396616288
396616283
396600013
396600008
396591873
396591868
396587803
396587798
...

output:

? 0 0
? 0 1
? 0 3333333
? 0 3333334
? 0 1666666
? 0 1666667
? 0 2499999
? 0 2500000
? 0 2083332
? 0 2083333
? 0 2291665
? 0 2291666
? 0 2395832
? 0 2395833
? 0 2447915
? 0 2447916
? 0 2473957
? 0 2473958
? 0 2460936
? 0 2460937
? 0 2454425
? 0 2454426
? 0 2457680
? 0 2457681
? 0 2459308
? 0 2459309
...

result:

ok Solution answered 261074243 ans asked 95 questions

Test #15:

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

input:

5000000 6666666 170
635994230
635994130
454114936
454114918
462178372
462178398
447751366
447751370
448271758
448271750
446918030
446918034
447438430
447438422
447021766
447021758
446906374
446906374
446917598
446917590
446906374
446906374
446906374
446906374
446906374
446906374
446911094
446911086
...

output:

? 0 0
? 0 1
? 0 3333333
? 0 3333334
? 0 4999999
? 0 5000000
? 0 4166666
? 0 4166667
? 0 3749999
? 0 3750000
? 0 3958332
? 0 3958333
? 0 3854165
? 0 3854166
? 0 3906248
? 0 3906249
? 0 3932290
? 0 3932291
? 0 3919269
? 0 3919270
? 0 3925779
? 0 3925780
? 0 3922524
? 0 3922525
? 0 3920896
? 0 3920897
...

result:

ok Solution answered 281773788 ans asked 97 questions

Subtask #4:

score: 5
Accepted

Test #16:

score: 5
Accepted
time: 1ms
memory: 3648kb

input:

10000000 10000000 100
951301000
951300900
451301000
451300900
201301000
201300900
194966800
194966900
138801000
138800900
163716800
163716900
148091800
148091900
140279300
140279400
136373000
136373100
136847900
136847800
135871400
135871300
135884700
135884800
135640500
135640600
135749400
13574930...

output:

? 0 0
? 0 1
? 0 5000000
? 0 5000001
? 0 7500000
? 0 7500001
? 0 8750000
? 0 8750001
? 0 8125000
? 0 8125001
? 0 8437500
? 0 8437501
? 0 8281250
? 0 8281251
? 0 8203125
? 0 8203126
? 0 8164062
? 0 8164063
? 0 8144531
? 0 8144532
? 0 8154296
? 0 8154297
? 0 8159179
? 0 8159180
? 0 8156737
? 0 8156738
...

result:

ok Solution answered 0 ans asked 97 questions

Test #17:

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

input:

10000000 10000000 100
1040046173
1040046074
797877949
797877944
831857269
831857298
803881051
803881070
798328787
798328792
797157713
797157712
797619975
797619978
797385600
797385603
797268411
797268414
797209818
797209821
797180520
797180523
797165871
797165874
797158548
797158551
797156493
797156...

output:

? 0 0
? 0 1
? 0 5000000
? 0 5000001
? 0 7500000
? 0 7500001
? 0 6250000
? 0 6250001
? 0 5625000
? 0 5625001
? 0 5312500
? 0 5312501
? 0 5468750
? 0 5468751
? 0 5390625
? 0 5390626
? 0 5351562
? 0 5351563
? 0 5332031
? 0 5332032
? 0 5322265
? 0 5322266
? 0 5317382
? 0 5317383
? 0 5314941
? 0 5314942
...

result:

ok Solution answered 493034338 ans asked 97 questions

Test #18:

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

input:

10000000 10000000 100
1005336219
1005336119
749920151
749920159
799944869
799944821
754790883
754790861
746928661
746928659
747757751
747757755
747132751
747132755
746915535
746915537
746850537
746850535
746876471
746876473
746856939
746856941
746847173
746847175
746845655
746845653
746844731
746844...

output:

? 0 0
? 0 1
? 0 5000000
? 0 5000001
? 0 2500000
? 0 2500001
? 0 3750000
? 0 3750001
? 0 4375000
? 0 4375001
? 0 4687500
? 0 4687501
? 0 4531250
? 0 4531251
? 0 4453125
? 0 4453126
? 0 4414062
? 0 4414063
? 0 4433593
? 0 4433594
? 0 4423827
? 0 4423828
? 0 4418944
? 0 4418945
? 0 4416503
? 0 4416504
...

result:

ok Solution answered 471261661 ans asked 97 questions

Test #19:

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

input:

5000000 6666666 100
527730925
527730826
407280398
407280421
407951529
407951494
396784608
396784613
398488673
398488660
397430088
397430083
396909253
396909248
396648838
396648833
396654398
396654403
396589293
396589298
396616288
396616283
396600013
396600008
396591873
396591868
396587803
396587798
...

output:

? 0 0
? 0 1
? 0 3333333
? 0 3333334
? 0 1666666
? 0 1666667
? 0 2499999
? 0 2500000
? 0 2083332
? 0 2083333
? 0 2291665
? 0 2291666
? 0 2395832
? 0 2395833
? 0 2447915
? 0 2447916
? 0 2473957
? 0 2473958
? 0 2460936
? 0 2460937
? 0 2454425
? 0 2454426
? 0 2457680
? 0 2457681
? 0 2459308
? 0 2459309
...

result:

ok Solution answered 261074243 ans asked 95 questions

Test #20:

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

input:

5000000 6666666 100
635994230
635994130
454114936
454114918
462178372
462178398
447751366
447751370
448271758
448271750
446918030
446918034
447438430
447438422
447021766
447021758
446906374
446906374
446917598
446917590
446906374
446906374
446906374
446906374
446906374
446906374
446911094
446911086
...

output:

? 0 0
? 0 1
? 0 3333333
? 0 3333334
? 0 4999999
? 0 5000000
? 0 4166666
? 0 4166667
? 0 3749999
? 0 3750000
? 0 3958332
? 0 3958333
? 0 3854165
? 0 3854166
? 0 3906248
? 0 3906249
? 0 3932290
? 0 3932291
? 0 3919269
? 0 3919270
? 0 3925779
? 0 3925780
? 0 3922524
? 0 3922525
? 0 3920896
? 0 3920897
...

result:

ok Solution answered 281773788 ans asked 97 questions

Subtask #5:

score: 0
Wrong Answer

Test #21:

score: 0
Wrong Answer
time: 1ms
memory: 3668kb

input:

10000000 10000000 75
951301000
951300900
451301000
451300900
201301000
201300900
194966800
194966900
138801000
138800900
163716800
163716900
148091800
148091900
140279300
140279400
136373000
136373100
136847900
136847800
135871400
135871300
135884700
135884800
135640500
135640600
135749400
135749300...

output:

? 0 0
? 0 1
? 0 5000000
? 0 5000001
? 0 7500000
? 0 7500001
? 0 8750000
? 0 8750001
? 0 8125000
? 0 8125001
? 0 8437500
? 0 8437501
? 0 8281250
? 0 8281251
? 0 8203125
? 0 8203126
? 0 8164062
? 0 8164063
? 0 8144531
? 0 8144532
? 0 8154296
? 0 8154297
? 0 8159179
? 0 8159180
? 0 8156737
? 0 8156738
...

result:

wrong answer Query Limit Exceeded!