QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#115435 | #4926. Where Is the Root? | aaargh | 0 | 0ms | 0kb | C++17 | 647b | 2023-06-26 09:32:48 | 2023-06-26 09:32:51 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define nl '\n'
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
signed main() {
io; int n; cin >> n;
vector<vector<int>> adjlist(n);
int a,b;
for (int i = 0; i < n-1; i++) {
cin >> a >> b;
adjlist[a].push_back(b);
adjlist[b].push_back(a);
}
string temp;
for (int i = 1; i <= n; i++) {
cout << "? " << n-1 << ' ';
for (int j = 1; j <= n; j++) {
if (i == j) continue;
cout << j << ' ';
}
cout << nl;
cout.flush();
cin >> temp;
if (temp == "NO") {
cout << "! " << i << nl;
break;
}
}
}
詳細信息
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 0
Runtime Error
input:
7 4 1 1 2 4 3 3 5 3 6 4 7
output:
result:
Subtask #2:
score: 0
Runtime Error
Test #24:
score: 0
Runtime Error
input:
30 1 15 29 30 1 4 7 28 29 17 1 26 26 7 12 5 27 13 3 7 27 1 21 15 9 22 22 5 24 27 19 1 25 30 22 27 6 15 16 13 18 2 27 10 27 30 20 26 8 15 18 8 14 1 27 23 11 3
output:
result:
Subtask #3:
score: 0
Runtime Error
Test #54:
score: 0
Runtime Error
input:
500 419 133 44 225 391 269 419 461 293 347 108 31 110 363 423 257 321 155 498 87 180 492 251 5 357 30 341 172 275 109 372 446 286 336 208 339 162 320 138 103 129 219 62 141 359 286 130 238 470 460 418 48 210 358 429 13 323 143 382 415 406 394 309 175 325 170 128 108 6 113 363 17 470 457 7 224 288 48...