Contest Duration: ~ (local time) (120 minutes) Back to Home

Submission #1911697

Source Code Expand

Copy
```#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
int n;
cin>>n;
ll a = 1, b = 1, mx = 0;
rep(j, 2){
mx = 0;
for(int i = 1; i <= n; i++){
if(i==a) continue;
cout<<"? "<<a<<" "<<i<<endl;
int d;
cin>>d;
if(d>mx){
mx = d;
b = i;
}
}
swap(a, b);
}
cout<<"! "<<mx<<endl;
return 0;
}
```

#### Submission Info

Submission Time 2017-12-26 17:00:29+0900 D - 高橋くんと木の直径 Lepton C++14 (GCC 5.4.1) 100 1434 Byte AC 7 ms 724 KB

#### Judge Result

Set Name Score / Max Score Test Cases
Case Name Status Exec Time Memory