QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#297060#2727. Gradient DescentCamillus#Compile Error//C++201.8kb2024-01-03 21:59:092024-07-04 03:16:38

Judging History

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

  • [2024-07-04 03:16:38]
  • 评测
  • [2024-01-03 21:59:09]
  • 提交

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

詳細信息

answer.code: In function ‘int main()’:
answer.code:36:9: error: expected ‘,’ or ‘;’ before ‘auto’
   36 |         auto get1 = [&](int k) -> int {
      |         ^~~~
answer.code:49:17: error: ‘get1’ was not declared in this scope; did you mean ‘getw’?
   49 |             if (get1(m) < 0) {
      |                 ^~~~
      |                 getw
answer.code:67:9: error: expected ‘,’ or ‘;’ before ‘auto’
   67 |         auto get1 = [&](int k) -> int {
      |         ^~~~
answer.code:80:17: error: ‘get1’ was not declared in this scope; did you mean ‘getw’?
   80 |             if (get1(m) < 0) {
      |                 ^~~~
      |                 getw