Submission #7058696


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
  	vector<pair<int, int>> q;
    for (int i = 0; i < n; i++){
      for (int j = i + 1; j < n; j++) q.push_back({i, j});
    }
    int dist;
    int ans = 0;
    for (int i = 0; i < min(1300, q.size()); i++){
      	int x = q[i].first + 1;
        int y = q[i].second + 1;
        cout << "? " << x << " " << y << endl;
        cin >> dist;
        ans = max(ans, dist);
    }
    cout << "! " << ans << endl;
}

Submission Info

Submission Time
Task D - 高橋くんと木の直径
User lemon_
Language C++14 (GCC 5.4.1)
Score 0
Code Size 514 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:13:43: error: no matching function for call to ‘min(int, std::vector<std::pair<int, int> >::size_type)’
     for (int i = 0; i < min(1300, q.size()); i++){
                                           ^
In file included from /usr/include/c++/5/bits/char_traits.h:39:0,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from ./Main.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/5/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
./Main.cpp:13:43: note:   deduced conflicting...