Skip to content

Instantly share code, notes, and snippets.

@ik11235
Created February 28, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ik11235/5c0497419b0b3393c830 to your computer and use it in GitHub Desktop.
Save ik11235/5c0497419b0b3393c830 to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[])
{
int n;
cin>>n;
long long int ans=0;
for(int i=1;i<n;i++)
for(int j=i+1;j<=n;j++)
{
cout<<"? "<<i<<" "<<j<<endl;
long long int tmp;
cin>>tmp;
ans=max(ans,tmp);
}
cout<<"! "<<ans<<endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment