QOJ.ac

QOJ

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

Judging History

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

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

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 get = [&](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 (get(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 get = [&](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 (get(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 get = [&](int k) -> int {
      |         ^~~~
answer.code:49:20: error: no matching function for call to ‘get(int&)’
   49 |             if (get(m) < 0) {
      |                 ~~~^~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:64,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from answer.code:5:
/usr/include/c++/13/bits/stl_pair.h:1035:5: note: candidate: ‘template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(pair<_Tp1, _Tp2>&)’
 1035 |     get(pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/13/bits/stl_pair.h:1035:5: note:   template argument deduction/substitution failed:
answer.code:49:20: note:   mismatched types ‘std::pair<_Tp1, _Tp2>’ and ‘int’
   49 |             if (get(m) < 0) {
      |                 ~~~^~~
/usr/include/c++/13/bits/stl_pair.h:1040:5: note: candidate: ‘template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(pair<_Tp1, _Tp2>&&)’
 1040 |     get(pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/13/bits/stl_pair.h:1040:5: note:   template argument deduction/substitution failed:
answer.code:49:20: note:   mismatched types ‘std::pair<_Tp1, _Tp2>’ and ‘int’
   49 |             if (get(m) < 0) {
      |                 ~~~^~~
/usr/include/c++/13/bits/stl_pair.h:1045:5: note: candidate: ‘template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const pair<_Tp1, _Tp2>&)’
 1045 |     get(const pair<_Tp1, _Tp2>& __in) noexcept
      |     ^~~
/usr/include/c++/13/bits/stl_pair.h:1045:5: note:   template argument deduction/substitution failed:
answer.code:49:20: note:   mismatched types ‘const std::pair<_Tp1, _Tp2>’ and ‘int’
   49 |             if (get(m) < 0) {
      |                 ~~~^~~
/usr/include/c++/13/bits/stl_pair.h:1050:5: note: candidate: ‘template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const pair<_Tp1, _Tp2>&&)’
 1050 |     get(const pair<_Tp1, _Tp2>&& __in) noexcept
      |     ^~~
/usr/include/c++/13/bits/stl_pair.h:1050:5: note:   template argument deduction/substitution failed:
answer.code:49:20: note:   mismatched types ‘const std::pair<_Tp1, _Tp2>’ and ‘int’
   49 |             if (get(m) < 0) {
      |                 ~~~^~~
/usr/include/c++/13/bits/stl_pair.h:1059:5: note: candidate: ‘template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_T1, _T2>&)’
 1059 |     get(pair<_Tp, _Up>& __p) noexcept
      |     ^~~
/usr/include/c++/13/bits/stl_pair.h:1059:5: note:   template argument deduction/substitution failed:
answer.code:49:20: note:   mismatched types ‘std::pair<_T1, _T2>’ and ‘int’
   49 |             if (get(m) < 0) {
      |                 ~~~^~~
/usr/include/c++/13/bits/stl_pair.h:1064:5: note: candidate: ‘template<class _Tp, class _Up> constexpr const _Tp& std::get(const pair<_T1, _T2>&)’
 1064 |     get(const pair<_Tp, _Up>& __p) noexcept
      |     ^~~
/usr/include/c++/13/bits/stl_pair.h:1064:5: note:   template argument deduction/substitution failed:
answer.code:49:20: note:   mismatched types ‘const std::pair<_T1, _T2>’ and ‘int’
   49 |             if (get(m) < 0) {
      |                 ~~~^~~
/usr/include/c++/13/bits/stl_pair.h:1069:5: note: candidate: ‘template<class _Tp, class _Up> constexpr _Tp&& std::get(pair<_T1, _T2>&&)’
 1069 |     get(pair<_Tp, _Up>&& __p) noexcept
      |     ^~~
/usr/include/c++/13/bits/stl_pair.h:1069:5: note:   template argument deduction/substitution failed:
answer.code:49:20: note:   mismatched types ‘std::pair<_T1, _T2>’ and ‘int’
   49 |             if (get(m) < 0) {
      |                 ~~~^~~
/usr/include/c++/13/bits/stl_pair.h:1074:5: note: candidate: ‘template<class _Tp, class _Up> constexpr const _Tp&& std::get(const pair<_T1, _T2>&&)’
 1074 |     get(const pair<_Tp, _Up>&& __p) noexcept
      |     ^~~
/usr/include/c++/13/bits/stl_pair.h:1074:5: note:   template argument deduction/substitution failed:
answer.code:49:20: note:   mismatched types ‘const std::pair<_T1, _T2>’ and ‘int’
   49 |             if (get(m) < 0) {
      |                 ~~~^~~
/usr/include/c++/13/bits/stl_pair.h:1079:5: note: candidate: ‘template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_Up, _Tp>&)’
 1079 |     get(pair<_Up, _Tp>& __p) noexcept
      |     ^~~
/usr/include/c++/13/bits/stl_pair.h:1079:5: note:   template argument deduction/substitution failed:
answer.code:49:20: note:   mismatched types ‘std::pair<_Up, _Tp>’ and ‘int’
   49 |             if (get(m) < 0) {
      |               ...