QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#771762#8056. Travel 2yuanruiqi#RE 1ms3744kbC++141.2kb2024-11-22 15:31:182024-11-22 15:31:19

Judging History

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

  • [2024-11-22 15:31:19]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:3744kb
  • [2024-11-22 15:31:18]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using pii = pair<int, int>;
constexpr int maxn = 2500 + 10;
map<int, int> e[maxn];
map<int, int> g[maxn];
void dfs(int u, int fa, int deg)
{
    for (int i=1;i<=deg;++i)
    {
        if (g[u].find(i) != g[u].end()) continue;
        cout << "> " << i << endl;
        int v, dv;
        cin >> v >> dv;
        g[u][i] = v;
        e[u][v] = i;
        if (e[v].find(u) != e[v].end())
        {
            cout << "> " << e[v][u] << endl;
            cin >> v >> dv;
        }
        else dfs(v, u, dv);
    }
    if (fa)
    {
        cout << "> " << e[u][fa] << endl;
        int v, dv;
        cin >> v >> dv;
    }
}
void solve()
{
    for (int i=0;i<maxn;++i) g[i].clear(), e[i].clear();
    int x, d;
    cin >> x >> d;
    dfs(x, 0, d);
    vector<pii> ans;
    for (int i=0;i<maxn;++i)
        for (auto [j, p] : e[i])
            if (i < j) ans.emplace_back(pii(i, j));
    cout << "!";
    for (auto [x, y] : ans) cout << ' ' << x << ' ' << y;
    cout << endl;
    string s;
    cin >> s;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--) solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3744kb

input:

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

output:

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

result:

ok correct! (2 test cases)

Test #2:

score: -100
Runtime Error

input:

1000
1 9
2 7
1 9
2 7
3 9
1 9
3 9
1 9
4 9
1 9
4 9
3 9
4 9
3 9
9 8
1 9
5 8
1 9
5 8
8 8
1 9
6 9
1 9
6 9
2 7
10 6
1 9
7 7
1 9
7 7
4 9
7 7
4 9
10 6
2 7
10 6
8 8
5 8
8 8
10 6
8 8
9 8
3 9
9 8
5 8
9 8
5 8
2 7
6 9
2 7
5 8
2 7
9 8
2 7
9 8
8 8
9 8
7 7
8 8
7 7
8 8
3 9
2 7
3 9
5 8
3 9
5 8
6 9
10 6
4 9
10 6
6 9
1...

output:

> 1
> 1
> 1
> 2
> 1
> 2
> 1
> 3
> 1
> 3
> 2
> 2
> 2
> 3
> 1
> 4
> 1
> 4
> 2
> 1
> 5
> 1
> 5
> 2
> 3
> 1
> 6
> 1
> 6
> 2
> 3
> 2
> 4
> 2
> 3
> 3
> 2
> 2
> 3
> 3
> 4
> 2
> 3
> 3
> 3
> 3
> 4
> 4
> 2
> 5
> 4
> 6
> 4
> 6
> 5
> 4
> 6
> 3
> 5
> 3
> 6
> 4
> 2
> 5
> 5
> 5
> 6
> 3
> 4
> 4
> 5
> 3
> 6
> 6
> 6
...

result: