QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#297062#2727. Gradient DescentCamillus#0 1ms3624kbC++201.8kb2024-01-03 21:59:302024-07-04 03:16:39

Judging History

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

  • [2024-07-04 03:16:39]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3624kb
  • [2024-01-03 21:59:30]
  • 提交

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 cnt = (query(0, 0) + query(R, C)) / (R + C);

    int x, y;

    {
        int L = query(0, 0);
        int R = query(R, 0);
        
        auto get1 = [&](int k) -> int {
            int cur = query(k, 0);

            int a = (R + cur - k * cnt) / 2;
            int b = (L + cur - k * cnt) / 2;

            return (cur - (b - a)) / k;
        };

        int l = 0, r = R;

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

        if (query(l, 0) < query(r, 0)) {
            x = l;
        } else {
            x = r;
        }
    }

    {
        int L = query(0, 0);
        int R = query(0, C);
        
        auto get1 = [&](int k) -> int {
            int cur = query(0, k);

            int a = (R + cur - k * cnt) / 2;
            int b = (L + cur - k * cnt) / 2;

            return (cur - (b - a)) / k;
        };

        int l = 0, r = C;

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

        if (query(0, l) < query(0, r)) {
            y = l;
        } else {
            y = r;
        }
    }

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

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3556kb

input:

1 90 90
7500
1600
7500
7500
382300
194800
101000
54100
30700
19000
13100
10200
8700
8000
7600
7400
7500
7400
7500
1700
3000
5300
6400
7000
7300
7400
7500
7400
7300

output:

? 0 0
? 1 90
? 0 0
? 0 0
? 3750 0
? 1875 0
? 937 0
? 468 0
? 234 0
? 117 0
? 58 0
? 29 0
? 14 0
? 7 0
? 3 0
? 1 0
? 0 0
? 1 0
? 0 0
? 0 90
? 0 45
? 0 22
? 0 11
? 0 5
? 0 2
? 0 1
? 0 0
? 0 1
? 1 1
! 7300

result:

wrong answer Wrong Answer: expected 0, found 7300

Subtask #2:

score: 0
Wrong Answer

Test #6:

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

input:

1 10000000 90
815667200
184332900
815667200
815667200
41599027000
21207347000
11011507000
5913587000
3364627000
2090147000
1452907000
1134287000
974977000
895322000
855494500
835580700
825623800
820645400
818156200
816911600
816289300
815978100
815822500
815744700
815705800
815686400
815676700
81567...

output:

? 0 0
? 1 10000000
? 0 0
? 0 0
? 407833600 0
? 203916800 0
? 101958400 0
? 50979200 0
? 25489600 0
? 12744800 0
? 6372400 0
? 3186200 0
? 1593100 0
? 796550 0
? 398275 0
? 199137 0
? 99568 0
? 49784 0
? 24892 0
? 12446 0
? 6223 0
? 3111 0
? 1555 0
? 777 0
? 388 0
? 194 0
? 97 0
? 48 0
? 24 0
? 12 0
...

result:

wrong answer Wrong Answer: expected 0, found 2147483647

Subtask #3:

score: 0
Wrong Answer

Test #11:

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

input:

10000000 10000000 170
951301000
1048699000
951301000
951301000
48245083200
24462558200
12571295700
6625664400
3652848800
2166441000
1423237100
1051635100
865834100
858400600
904850800
928075900
939688500
945494800
948397900
949849500
950575300
950938200
951119600
951210300
951255700
951278400
951289...

output:

? 0 0
? 10000000 10000000
? 0 0
? 0 0
? 475650500 0
? 237825250 0
? 118912625 0
? 59456312 0
? 29728156 0
? 14864078 0
? 7432039 0
? 3716019 0
? 1858009 0
? 929004 0
? 464502 0
? 232251 0
? 116125 0
? 58062 0
? 29031 0
? 14515 0
? 7257 0
? 3628 0
? 1814 0
? 907 0
? 453 0
? 226 0
? 113 0
? 56 0
? 28 ...

result:

wrong answer Wrong Answer: expected 0, found 2147483647

Subtask #4:

score: 0
Wrong Answer

Test #16:

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

input:

10000000 10000000 100
951301000
1048699000
951301000
951301000
48245083200
24462558200
12571295700
6625664400
3652848800
2166441000
1423237100
1051635100
865834100
858400600
904850800
928075900
939688500
945494800
948397900
949849500
950575300
950938200
951119600
951210300
951255700
951278400
951289...

output:

? 0 0
? 10000000 10000000
? 0 0
? 0 0
? 475650500 0
? 237825250 0
? 118912625 0
? 59456312 0
? 29728156 0
? 14864078 0
? 7432039 0
? 3716019 0
? 1858009 0
? 929004 0
? 464502 0
? 232251 0
? 116125 0
? 58062 0
? 29031 0
? 14515 0
? 7257 0
? 3628 0
? 1814 0
? 907 0
? 453 0
? 226 0
? 113 0
? 56 0
? 28 ...

result:

wrong answer Wrong Answer: expected 0, found 2147483647

Subtask #5:

score: 0
Wrong Answer

Test #21:

score: 0
Wrong Answer
time: 0ms
memory: 3556kb

input:

10000000 10000000 75
951301000
1048699000
951301000
951301000
48245083200
24462558200
12571295700
6625664400
3652848800
2166441000
1423237100
1051635100
865834100
858400600
904850800
928075900
939688500
945494800
948397900
949849500
950575300
950938200
951119600
951210300
951255700
951278400
9512897...

output:

? 0 0
? 10000000 10000000
? 0 0
? 0 0
? 475650500 0
? 237825250 0
? 118912625 0
? 59456312 0
? 29728156 0
? 14864078 0
? 7432039 0
? 3716019 0
? 1858009 0
? 929004 0
? 464502 0
? 232251 0
? 116125 0
? 58062 0
? 29031 0
? 14515 0
? 7257 0
? 3628 0
? 1814 0
? 907 0
? 453 0
? 226 0
? 113 0
? 56 0
? 28 ...

result:

wrong answer Wrong Answer: expected 0, found 2147483647