QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#297070#2727. Gradient DescentCamillus#0 1ms3672kbC++201.8kb2024-01-03 22:15:142024-07-04 03:16:39

Judging History

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

  • [2024-07-04 03:16:39]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3672kb
  • [2024-01-03 22:15:14]
  • 提交

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 a - b;
        };

        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 a - b;
        };

        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;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

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
800
500
1100
1400
1500
1600
1600
1700
1500

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 67
? 0 78
? 0 84
? 0 87
? 0 88
? 0 89
? 0 89
? 0 90
? 1 89
! 1500

result:

wrong answer Wrong Answer: expected 0, found 1500

Subtask #2:

score: 0
Wrong Answer

Test #6:

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

input:

1 10000000 90
815667200
184332900
815667200
815667200
41599027000
21207347000
11011507000
5913587000
3364627000
2090147000
1452907000
1134287000
974977000
895322000
855494500
835580700
825623800
820645400

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: 3552kb

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: 3580kb

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: 3628kb

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