제출 #1350115

#제출 시각아이디문제언어결과실행 시간메모리
1350115FIFI_cppStaring Contest (BOI23_staringcontest)C++20
0 / 100
6 ms432 KiB
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <fstream>
#include <iterator>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <cctype>
#include <string>
#include <cassert>
#include <set>
#include <bitset>
#include <unordered_set>
#include <numeric>

#define all(a) a.begin(), a.end()
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ppi pair<int,pair<int,int>>
#define int int64_t

using namespace std;
//    /\_/\
//   (= ._.)
//   / >  \>
// encouraging cat
const int INF = 10000000000000000;
//const int mod = 1000000007;
const int mod = 998244353;
const int MAXN = 200005;
//ifstream fin('xor.in');
//ofstream fout('xor.out');
int ask(int i, int j)
{
    cout << "? " << i << " " << j << '\n';
    cout.flush();
    int x;
    cin >> x;
    return x;
}
signed main()
{
    int n;
    cin >> n;
    vector<int> res(n + 1, 0);
    int p1 = 1, p2 = 2;
    int v = ask(p1, p2);
    for (int i = 3;i <= n;i++)
    {
        int va = ask(i, p1);
        int vb = ask(i, p2);
        if (va == v)
        {
            res[p1] = v;
            p1 = i;
            v = vb;
        }
        else if (vb == v)
        {
            res[p2] = v;
            p2 = i;
            v = va;
        }
    }
    res[p1] = v;
    res[p2] = v;
    cout << "! ";
    for (int i = 1;i <= n;i++)
    {
        cout << res[i] << " ";
    }
    cout << '\n';
    cout.flush();
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...