| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1342302 | Jakub_Wozniak | Staring Contest (BOI23_staringcontest) | C++20 | 12 ms | 444 KiB |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 50009;
int ans[maxn];
int query(int a , int b)
{
cout << "? " << a << ' ' << b << endl;
int r;
cin >> r;
return r;
}
int main()
{
int n ;
cin >> n;
int i = 1 , j = 2;
int aktS = query(i,j);
for(int k = 3; k <= n ; k++)
{
int ik = query(i , k);
if(aktS == ik)
{
ans[i] = ik;
i = k;
aktS = query(i,j);
}
else if(aktS < ik)
{
ans[j] = aktS;
j = k;
aktS = ik;
}
else
{
ans[k] = ik;
}
}
ans[i] = aktS;
ans[j] = aktS;
cout << "! ";
for(int i = 1; i <= n ; i++)cout << ans[i] << ' ';
cout << endl;
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
