QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#877671#8056. Travel 2FangYifanRE 0ms0kbC++201.1kb2025-02-01 00:29:032025-02-01 00:29:04

Judging History

This is the latest submission verdict.

  • [2025-02-01 00:29:04]
  • Judged
  • Verdict: RE
  • Time: 0ms
  • Memory: 0kb
  • [2025-02-01 00:29:03]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
constexpr int mod = 998244353;

constexpr int N = 2510;
int n, deg[N];
int move(int id) {
    cout << "> " << id << endl;
    int x; cin >> x >> deg[x];
    n = max(n, x);
    return x;
}
vector<int> edge[N];
int vis[N], cur[N], adj[N][N];
void dfs(int u) {
    for (int &i = cur[u]; i < deg[u];) {
        int v = move(++i);
        edge[u].push_back(v);
        adj[u][v] = i;
        if (adj[v][u]) move(adj[v][u]);
        else dfs(v);
    }
}
void solve() {
    int x;
    cin >> x >> deg[1];
    dfs(1);
    cout << "!";
    for (int i = 1; i <= n; i++) {
        for (auto j : edge[i]) {
            if (i < j) cout << ' ' << i << ' ' << j;
        }
    }
    cout << endl;
    string Correct; cin >> Correct;
    for (int i = 1; i <= n; i++) {
        deg[i] = vis[i] = cur[i] = 0;
        for (auto j : edge[i]) adj[i][j] = 0;
        edge[i].clear();
    }
    n = 0;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int tt = 1;
    cin >> tt;
    while (tt--) {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Runtime Error

input:

2
1 1
2 1
1 1
2 1
Correct
1 3
2 2
1 3
2 2
4 2
1 3
3 1
1 3
3 1

output:

> 1
> 1
> 1
! 1 2
> 1
> 1
> 1
> 2
> 1
> 2
> 1
> 2
> 3

result: