QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#567649#9313. Make MaxxiangjiWA 0ms3740kbC++111.4kb2024-09-16 13:16:202024-09-16 13:16:24

Judging History

你现在查看的是最新测评结果

  • [2024-09-18 15:56:24]
  • hack成功,自动添加数据
  • (/hack/836)
  • [2024-09-16 13:16:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3740kb
  • [2024-09-16 13:16:20]
  • 提交

answer

// #pragma GCC optimize(2)
// #pragma GCC optimize(3,"Ofast","inline")
#pragma comment(linker, "/ STACK : 1024000000, 1024000000 ")
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "D:/OneDrive/study/cpp/.vscode/debug.h"
#else
#define debug(...) 42;
#endif
#define int long long
#define endl "\n"
#define ull unsigned long long
#define ll __int128_t
mt19937 rd(chrono::system_clock::now().time_since_epoch().count());
const int mod = 998244353;
const int inf = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 2e5 + 10;
const double eps = 1e-6;
const int hash_p1 = 1610612741;
const int hash_p2 = 805306457;
const int hash_p3 = 402653189;
const int base_1 = 131;
const int base_2 = 13331;
int n, t;
int vis[1010];
void solve()
{
    cin >> n;
    for (int i = 1; i < n; i++)
    {
        if (!vis[i])
        {
            t = i + 1;
            while (t != min(t, i))
            {
                cout << "? " << i << ' ' << t << endl;
                cin >> t;
            }
            vis[t] = i;
        }
    }
    cout << "! ";
    for (int i = 1; i < n; i++)
    {
        if (vis[i])
        {
            cout << vis[i] << ' ' << i << ' ';
        }
    }
}

signed main()
{
    // ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int _ = 1;
    cin >> _;
    while (_--)
        solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3740kb

input:

4
2
1 2
2
2 2
7
1 1 1 2 2 2 2
3
1 2 3

output:

? 1 2
! 1 1 ! 1 1 ! 1 1 ! 1 1 

result:

wrong output format Expected integer, but "?" found