QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#21225 | #2810. Speedrun | Qingyu | 39 | 345ms | 4200kb | C++20 | 4.8kb | 2022-03-03 19:59:57 | 2024-05-20 18:51:06 |
Judging History
你现在查看的是测评时间为 2024-05-20 18:51:06 的历史记录
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-03-03 19:59:57]
- 提交
speedrun
#include "speedrun.h"
#include<bits/stdc++.h>
using namespace std;
const int N = 1005;
int n, f[N], cnt, deg[N], l[N] ;
vector<int> V[N];
/*
#include <iostream>
#include <map>
#include <set>
using namespace std;
static map<int, map<int, bool> > mp;
static int length = -1;
static int queries = 0;
static bool length_set = false;
static int current_node = 0;
static set<int> viz;
static map<int, set<int> > neighbours;
void setHintLen(int l) {
if (length_set) {
cerr << "Cannot call setHintLen twice" << endl;
exit(0);
}
length = l;
length_set = true;
}
void setHint(int i, int j, bool b) {
if (!length_set) {
cerr << "Must call setHintLen before setHint" << endl;
exit(0);
}
mp[i][j] = b;
}
int getLength() { return length; }
bool getHint(int j) { return mp[current_node][j]; }
bool goTo(int x) {
if (neighbours[current_node].find(x) == neighbours[current_node].end()) {
++queries;
return false;
} else {
viz.insert(current_node = x);
cout << current_node <<" is current" << endl;
return true;
}
} */
void add(int a,int b) {
if(deg[a] == 1) {
for(int j = 1; j <= 10; j++) {
if(b & (1 << (j - 1))) setHint(a, j, 1);
}
return;
}
for(int j = 11; j <= 20; j++) {
if(b & (1 << (j - 11))) setHint(a, j, 1);
}
}
void assignHints(int subtask, int N, int A[], int B[]) { /* your solution here */
if(subtask == 1) {
setHintLen(N);
for(int i = 1; i < N; i++) {
setHint(A[i], B[i], 1);
setHint(B[i], A[i], 1);
}
}
else if(subtask == 2) {
setHintLen(20);
int x = -1;
for(int i = 1; i < N; i++) {
deg[A[i]]++; deg[B[i]]++;
if(deg[A[i]] == N - 2) x = A[i];
if(deg[B[i]] == N - 2) x = A[i];
}
for(int i = 1; i <= N; i++) {
if(i == x) continue;
for(int j = 1; j <= 10; j++) {
if((1 << (j - 1)) & x) setHint(i, j, 1);
}
}
}
else if(subtask == 3) {
setHintLen(20);
for(int i = 1; i < N; i++) {
deg[A[i]]++; deg[B[i]]++;
add(A[i], B[i]);
add(B[i], A[i]);
}
}
else if(subtask == 4) {
setHintLen(311);
vector<int> V[N + 5];
for(int i = 1; i < N; i++) {
V[A[i]].push_back(B[i]);
V[B[i]].push_back(A[i]);
}
for(int i = 1; i <= N; i++) {
if(V[i].size() <= 31) {
int cur = 1;
for(int j = 0; j< V[i].size(); j++) {
for(int k = 1;k <= 10; k++) {
if(V[i][j] & (1 << ( k - 1))) setHint(i, cur, 1);
cur++;
}
}
}
else setHint(i, 311, 1);
}
}
}
void dfs2(int u) {
int x = 0;
for(int j = 1; j <= 10; j++) x += (1 << (j - 1)) * getHint(j);
if(!x) {
for(int i = 1; i <= n; i++) {
if(i == u || f[i]) continue;
f[i] = 1; cnt++;
assert(goTo(i));
dfs2(i);
}
}
else if(cnt == n) return;
else goTo(x), dfs2(x);
}
void dfs(int u,int subtask, int par) {
if(subtask == 1){
for(int i = 1; i <= n; i++) {
if(getHint(i)) V[u].push_back(i);
}
}
else{
int x = 0;
for(int i = 1; i <= 10; i++) {
x += getHint(i) * ((1 << (i - 1)));
}
V[u].push_back(x);
x = 0;
for(int i = 11; i <= 20; i++) {
x += getHint(i) * ((1 << (i - 11)));
}
if(x) V[u].push_back(x);
}
for(int i = 0; i < V[u].size(); i++) {
if(V[u][i] == par) continue;
goTo(V[u][i]);
dfs(V[u][i], subtask, u);
}
if(par != - 1)goTo(par);
}
void dfs4(int u, int par) {
if(!getHint(311)) {
for(int i = 1; i <= 31; i++) {
int x = 0;
for(int j = 1; j <= 10; j++) {
if(getHint((i - 1) * 10 + j)) x += 1 << (j - 1);
}
if(x) V[u].push_back(x);
}
for(int i = 0; i < V[u].size(); i++) {
if(V[u][i] != par) cnt++, goTo(V[u][i]), dfs4(V[u][i], u);
}
}
else {
for(int i = 1; i <= n; i++) {
if(i == u || par == i) continue;
int t = goTo(i);
if(par != i && t) {
cnt++;
dfs4(i, u);
}
}
}
if(par != -1) goTo(par);
}
void speedrun(int subtask, int N, int start) { /* your solution here */
n = N;
if(subtask == 1) dfs(start, 1, -1);
if(subtask == 2) {
dfs2(start);
}
else if(subtask == 3) {
dfs(start, 3, -1);
}
else if(subtask == 4) { cnt = 0;
dfs4(start, -1);
}
}
/*
int main() {
int N;
cin >> N;
int a[N], b[N];
for (int i = 1; i < N; ++i) {
cin >> a[i] >> b[i];
neighbours[a[i]].insert(b[i]);
neighbours[b[i]].insert(a[i]);
}
assignHints(4, N, a, b);
if (!length_set) {
cerr << "Must call setHintLen at least once" << endl;
exit(0);
}
cin >> current_node;
viz.insert(current_node);
speedrun(4, N, current_node);
if (viz.size() < N) {
cerr << "Haven't seen all nodes" << endl;
exit(0);
}
cerr << "OK; " << queries << " incorrect goto's" << endl;
return 0;
} */
详细
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 0
Time Limit Exceeded
input:
1 1 1000 1 119 1 453 1 454 2 59 3 113 3 657 3 824 4 494 5 33 5 550 5 937 6 287 7 222 7 577 7 742 8 626 9 896 10 204 11 638 12 305 12 552 12 791 13 246 14 840 15 95 15 316 15 772 16 109 16 551 16 846 17 581 18 142 19 601 19 744 19 977 20 361 20 404 20 845 21 245 21 410 21 518 22 351 23 971 24 497 24 ...
output:
1 1 1000 1 2 1 119 1 1 2 119 1 1 1 2 1 453 1 1 2 453 1 1 1 2 1 454 1 1 2 454 1 1 1 2 2 59 1 1 2 59 2 1 1 2 3 113 1 1 2 113 3 1 1 2 3 657 1 1 2 657 3 1 1 2 3 824 1 1 2 824 3 1 1 2 4 494 1 1 2 494 4 1 1 2 5 33 1 1 2 33 5 1 1 2 5 550 1 1 2 550 5 1 1 2 5 937 1 1 2 937 5 1 1 2 6 287 1 1 2 287 6 1 1 2 7 2...
input:
2 1 1000 500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 2 21 2 2 22 2 2 23 2 2 24 2 2 25 2 2 26 2 2 27 2 2 28 2 2 29 2 2 30 2 2 31 2 2 32 2 2 33 2 2 34 2 2 35 2 2 36 2 2 37 2 2 38 2 2 39 2 2 40 2 2 41 2 2 42 2 2 43 2 2 44 2...
result:
wrong answer Solution didn't visit every node
Subtask #2:
score: 8
Accepted
Test #5:
score: 8
Accepted
time: 11ms
memory: 3824kb
input:
1 2 1000 1 133 2 133 3 133 4 133 5 133 6 133 7 133 8 133 9 133 10 133 11 133 12 133 13 133 14 133 15 133 16 133 17 133 18 133 19 133 20 133 21 133 22 133 23 133 24 133 25 133 26 133 27 133 28 133 29 133 30 133 31 133 32 133 33 133 34 133 35 133 36 133 37 133 38 133 39 133 40 133 41 133 42 133 43 133...
output:
1 1 20 1 2 1 1 1 1 2 1 3 1 1 2 1 8 1 1 2 2 1 1 1 2 2 3 1 1 2 2 8 1 1 2 3 1 1 1 2 3 3 1 1 2 3 8 1 1 2 4 1 1 1 2 4 3 1 1 2 4 8 1 1 2 5 1 1 1 2 5 3 1 1 2 5 8 1 1 2 6 1 1 1 2 6 3 1 1 2 6 8 1 1 2 7 1 1 1 2 7 3 1 1 2 7 8 1 1 2 8 1 1 1 2 8 3 1 1 2 8 8 1 1 2 9 1 1 1 2 9 3 1 1 2 9 8 1 1 2 10 1 1 1 2 10 3 1 1...
input:
2 2 1000 651 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0...
output:
2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 3 133 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 3 1 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 3 133 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 3 2 2 2 1 2 2 2 2 2 3 2 2 4 2 2 ...
result:
ok OK
Test #6:
score: 8
Accepted
time: 17ms
memory: 3852kb
input:
1 2 1000 1 577 2 577 3 577 4 577 5 577 6 577 7 577 8 577 9 577 10 577 11 577 12 577 13 577 14 577 15 577 16 577 17 577 18 577 19 577 20 577 21 577 22 577 23 577 24 577 25 577 26 577 27 577 28 577 29 577 30 577 31 577 32 577 33 577 34 577 35 577 36 577 37 577 38 577 39 577 40 577 41 577 42 577 43 577...
output:
1 1 20 1 2 1 1 1 1 2 1 7 1 1 2 1 10 1 1 2 2 1 1 1 2 2 7 1 1 2 2 10 1 1 2 3 1 1 1 2 3 7 1 1 2 3 10 1 1 2 4 1 1 1 2 4 7 1 1 2 4 10 1 1 2 5 1 1 1 2 5 7 1 1 2 5 10 1 1 2 6 1 1 1 2 6 7 1 1 2 6 10 1 1 2 7 1 1 1 2 7 7 1 1 2 7 10 1 1 2 8 1 1 1 2 8 7 1 1 2 8 10 1 1 2 9 1 1 1 2 9 7 1 1 2 9 10 1 1 2 10 1 1 1 2...
input:
2 2 1000 577 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1...
output:
2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 3 1 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 3 577 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 3 2 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 3 577 2 2 1 2 2 2 2 2 3 2 2 4 2 2 ...
result:
ok OK
Subtask #3:
score: 19
Accepted
Test #7:
score: 19
Accepted
time: 23ms
memory: 3876kb
input:
1 3 1000 1 20 1 569 2 69 2 72 3 510 3 811 4 278 4 994 5 890 5 918 6 97 6 577 7 11 7 791 8 138 8 653 9 219 9 539 10 22 10 151 11 527 12 195 12 420 13 187 13 293 14 265 14 476 15 594 15 988 16 424 16 881 17 407 17 613 18 178 18 471 19 400 19 896 20 95 21 221 21 949 22 624 23 247 23 361 24 140 24 169 2...
output:
1 1 20 1 2 1 3 1 1 2 1 5 1 1 2 20 1 1 1 2 1 11 1 1 2 1 14 1 1 2 1 15 1 1 2 1 16 1 1 2 1 20 1 1 2 569 1 1 1 2 2 1 1 1 2 2 3 1 1 2 2 7 1 1 2 69 2 1 1 2 2 14 1 1 2 2 17 1 1 2 72 2 1 1 2 3 2 1 1 2 3 3 1 1 2 3 4 1 1 2 3 5 1 1 2 3 6 1 1 2 3 7 1 1 2 3 8 1 1 2 3 9 1 1 2 510 1 1 1 2 510 2 1 1 2 3 11 1 1 2 3 ...
input:
2 3 1000 986 0 0 1 1 0 1 0 0 1 0 1 0 0 0 0 0 1 1 1 0 1 0 1 1 0 1 1 0 1 1 0 0 1 0 1 1 0 1 1 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 1 0 1 0 0 0 1 0 1 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 1 0 0 0 1 0 1 0 1 1 1 0 1 0 1 0 1 1 1 0 0 1 1 0 0 0 0 0 0...
output:
2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 3 300 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 3 438 2 2 1 2 2 2 2 2 3 2 2 ...
result:
ok OK
Test #8:
score: 19
Accepted
time: 33ms
memory: 4200kb
input:
1 3 1000 1 240 1 264 2 150 2 316 3 62 3 573 4 37 4 458 5 346 5 453 6 141 6 418 7 64 7 110 8 473 8 822 9 55 9 713 10 368 10 610 11 520 11 542 12 842 12 962 13 486 13 831 14 46 14 999 15 69 15 586 16 318 16 538 17 154 17 709 18 157 18 174 19 126 19 163 20 107 20 293 21 364 21 444 22 260 22 307 23 807 ...
output:
1 1 20 1 2 1 5 1 1 2 1 6 1 1 2 1 7 1 1 2 1 8 1 1 2 240 1 1 1 2 1 14 1 1 2 1 19 1 1 2 264 1 1 1 2 2 2 1 1 2 2 3 1 1 2 2 5 1 1 2 2 8 1 1 2 150 2 1 1 2 2 13 1 1 2 2 14 1 1 2 2 15 1 1 2 2 16 1 1 2 2 19 1 1 2 316 2 1 1 2 3 2 1 1 2 3 3 1 1 2 3 4 1 1 2 3 5 1 1 2 3 6 1 1 2 62 1 1 1 2 62 2 1 1 2 3 11 1 1 2 3...
input:
2 3 1000 718 1 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 0 1 1 0 0 1 1 0 0 0 0 0 1 1 1 1 0 0 0 1 1 0 1 1 0 0 1 0 0 1 0 1 0 1 1 0 0 1 0 1 1 0 1 1 1 0 0 1 1 0 0 0 0 0 1 1 0 1 0 0 1 0 1 1 1 1 0 1 0 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 1 1 1 1 0 0 1 1 0 1 0 1 1 1 0 1 0 0 1 0 1...
output:
2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 3 711 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 3 676 2 2 1 2 2 2 2 2 3 2 2 ...
result:
ok OK
Test #9:
score: 19
Accepted
time: 15ms
memory: 3892kb
input:
1 3 1000 1 395 1 881 2 288 2 434 3 172 3 463 4 14 4 83 5 758 5 857 6 150 6 305 7 125 7 301 8 252 8 590 9 225 9 931 10 127 10 203 11 65 11 629 12 455 12 975 13 265 13 329 14 734 15 196 15 231 16 242 16 500 17 447 17 710 18 190 18 885 19 154 19 636 20 101 20 616 21 151 21 679 22 84 22 164 23 76 23 835...
output:
1 1 20 1 2 1 1 1 1 2 1 2 1 1 2 1 4 1 1 2 1 8 1 1 2 1 9 1 1 2 395 1 1 1 2 1 11 1 1 2 1 15 1 1 2 1 16 1 1 2 1 17 1 1 2 1 19 1 1 2 1 20 1 1 2 881 1 1 1 2 2 6 1 1 2 2 9 1 1 2 288 2 1 1 2 2 12 1 1 2 2 15 1 1 2 2 16 1 1 2 2 18 1 1 2 2 19 1 1 2 434 2 1 1 2 3 3 1 1 2 3 4 1 1 2 3 6 1 1 2 3 8 1 1 2 172 1 1 1 ...
input:
2 3 1000 871 0 0 0 1 1 1 0 0 0 0 0 0 1 1 0 1 1 0 1 0 1 0 1 0 0 0 1 0 0 0 0 1 1 1 0 0 1 1 0 1 1 1 0 0 0 1 1 1 0 0 0 0 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 1 0 1 0 0 0 1 0 0 1 0 0 0 0 0 1 1 0 1 0 0 1 0 0 0 0 1 0 0 0 1 1 1 1 0 1 1 1 1 0 0 1 0 0 0 0 0 1 1 1 1 1 0 0 1 1...
output:
2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 3 56 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 3 34 2 2 1 2 2 2 2 2 3 2 2 4 ...
result:
ok OK
Subtask #4:
score: 12
Accepted
Test #10:
score: 12
Accepted
time: 287ms
memory: 4116kb
input:
1 4 1000 1 103 1 881 2 195 2 740 3 224 4 558 5 749 5 788 6 189 7 221 8 362 9 267 9 547 10 205 10 813 10 926 11 23 12 687 13 225 14 366 14 768 15 58 15 156 15 869 16 79 16 225 17 61 17 437 18 500 18 534 18 768 18 989 19 300 20 909 21 970 22 245 22 425 23 528 23 669 23 809 23 890 24 121 24 778 25 845 ...
output:
1 1 311 1 2 1 1 1 1 2 1 2 1 1 2 1 3 1 1 2 1 6 1 1 2 1 7 1 1 2 1 11 1 1 2 1 15 1 1 2 1 16 1 1 2 1 17 1 1 2 1 19 1 1 2 1 20 1 1 2 2 1 1 1 2 2 2 1 1 2 2 7 1 1 2 2 8 1 1 2 2 13 1 1 2 2 16 1 1 2 2 17 1 1 2 2 18 1 1 2 2 20 1 1 2 3 6 1 1 2 3 7 1 1 2 3 8 1 1 2 4 2 1 1 2 4 3 1 1 2 4 4 1 1 2 4 6 1 1 2 4 10 1 ...
input:
2 4 1000 196 0 1 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
2 2 311 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 2 21 2 2 22 2 2 23 2 2 24 2 2 25 2 2 26 2 2 27 2 2 28 2 2 29 2 2 30 2 2 31 2 2 32 2 2 33 2 2 34 2 2 35 2 2 36 2 2 37 2 2 38 2 2 39 2 2 40 2 2 41 2 2 42 2 2 43 ...
result:
ok OK
Test #11:
score: 12
Accepted
time: 337ms
memory: 4108kb
input:
1 4 1000 1 324 1 458 1 592 2 187 2 495 2 811 3 11 4 847 5 660 6 579 7 504 8 364 8 474 8 825 9 81 9 755 9 827 10 707 11 680 11 934 12 245 13 937 14 509 14 716 14 783 15 179 15 684 15 856 16 208 16 232 16 260 17 810 17 862 17 892 18 241 19 140 19 496 19 545 20 206 20 339 20 717 21 716 22 664 22 723 22...
output:
1 1 311 1 2 1 3 1 1 2 1 7 1 1 2 1 9 1 1 2 1 12 1 1 2 1 14 1 1 2 1 17 1 1 2 1 18 1 1 2 1 19 1 1 2 1 25 1 1 2 1 27 1 1 2 1 30 1 1 2 2 1 1 1 2 2 2 1 1 2 2 4 1 1 2 2 5 1 1 2 2 6 1 1 2 2 8 1 1 2 2 11 1 1 2 2 12 1 1 2 2 13 1 1 2 2 14 1 1 2 2 16 1 1 2 2 17 1 1 2 2 18 1 1 2 2 19 1 1 2 2 21 1 1 2 2 22 1 1 2 ...
input:
2 4 1000 321 0 0 0 0 1 0 1 1 0 0 1 0 1 0 0 1 1 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
2 2 311 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 2 21 2 2 22 2 2 23 2 2 24 2 2 25 2 2 26 2 2 27 2 2 28 2 2 29 2 2 30 2 2 31 2 2 32 2 2 33 2 2 34 2 2 35 2 2 36 2 2 37 2 2 38 2 2 39 2 2 40 2 2 41 2 2 42 2 2 43 ...
result:
ok OK
Test #12:
score: 12
Accepted
time: 345ms
memory: 4080kb
input:
1 4 1000 1 520 2 907 3 861 4 464 5 881 6 726 7 639 8 786 9 860 10 732 11 777 12 522 13 789 14 792 15 392 16 861 17 789 18 522 19 726 20 449 21 392 22 61 23 117 24 392 25 522 26 371 27 833 28 777 29 918 30 881 31 732 32 556 33 117 34 833 35 918 36 861 37 726 38 860 39 117 40 632 41 420 42 774 43 747 ...
output:
1 1 311 1 2 1 4 1 1 2 1 10 1 1 2 2 1 1 1 2 2 2 1 1 2 2 4 1 1 2 2 8 1 1 2 2 9 1 1 2 2 10 1 1 2 3 1 1 1 2 3 3 1 1 2 3 4 1 1 2 3 5 1 1 2 3 7 1 1 2 3 9 1 1 2 3 10 1 1 2 4 5 1 1 2 4 7 1 1 2 4 8 1 1 2 4 9 1 1 2 5 1 1 1 2 5 5 1 1 2 5 6 1 1 2 5 7 1 1 2 5 9 1 1 2 5 10 1 1 2 6 2 1 1 2 6 3 1 1 2 6 5 1 1 2 6 7 ...
input:
2 4 1000 984 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
2 2 311 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 2 21 2 2 22 2 2 23 2 2 24 2 2 25 2 2 26 2 2 27 2 2 28 2 2 29 2 2 30 2 2 31 2 2 32 2 2 33 2 2 34 2 2 35 2 2 36 2 2 37 2 2 38 2 2 39 2 2 40 2 2 41 2 2 42 2 2 43 ...
result:
ok OK
Test #13:
score: 12
Accepted
time: 324ms
memory: 3888kb
input:
1 4 1000 1 975 1 981 2 398 2 808 3 673 4 673 5 673 6 334 6 543 7 673 8 673 9 673 10 448 10 707 11 252 11 486 12 673 13 335 13 943 14 624 14 663 15 673 16 673 17 673 18 673 19 673 20 673 21 132 21 877 22 673 23 673 24 673 25 348 25 536 26 673 27 673 28 588 28 845 29 563 29 860 30 716 30 906 31 673 32...
output:
1 1 311 1 2 1 1 1 1 2 1 2 1 1 2 1 3 1 1 2 1 4 1 1 2 1 7 1 1 2 1 8 1 1 2 1 9 1 1 2 1 10 1 1 2 1 11 1 1 2 1 13 1 1 2 1 15 1 1 2 1 17 1 1 2 1 18 1 1 2 1 19 1 1 2 1 20 1 1 2 2 2 1 1 2 2 3 1 1 2 2 4 1 1 2 2 8 1 1 2 2 9 1 1 2 2 14 1 1 2 2 16 1 1 2 2 19 1 1 2 2 20 1 1 2 3 1 1 1 2 3 6 1 1 2 3 8 1 1 2 3 10 1...
input:
2 4 1000 136 0 0 0 1 1 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
2 2 311 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 2 21 2 2 22 2 2 23 2 2 24 2 2 25 2 2 26 2 2 27 2 2 28 2 2 29 2 2 30 2 2 31 2 2 32 2 2 33 2 2 34 2 2 35 2 2 36 2 2 37 2 2 38 2 2 39 2 2 40 2 2 41 2 2 42 2 2 43 ...
result:
ok OK
Test #14:
score: 12
Accepted
time: 322ms
memory: 3924kb
input:
1 4 1000 1 61 1 330 1 587 2 67 2 383 2 719 3 856 3 878 3 973 4 391 5 248 5 391 5 983 6 118 6 354 6 730 7 327 7 467 7 778 8 402 8 496 8 526 9 239 9 686 9 749 10 280 10 914 11 87 11 651 12 203 12 572 13 203 14 485 14 498 15 21 15 89 15 128 16 437 16 512 16 838 17 111 17 273 18 519 19 302 19 335 19 915...
output:
1 1 311 1 2 1 1 1 1 2 1 3 1 1 2 1 4 1 1 2 1 5 1 1 2 1 6 1 1 2 1 12 1 1 2 1 14 1 1 2 1 17 1 1 2 1 19 1 1 2 1 21 1 1 2 1 22 1 1 2 1 24 1 1 2 1 27 1 1 2 1 30 1 1 2 2 1 1 1 2 2 2 1 1 2 2 7 1 1 2 2 11 1 1 2 2 12 1 1 2 2 13 1 1 2 2 14 1 1 2 2 15 1 1 2 2 16 1 1 2 2 17 1 1 2 2 19 1 1 2 2 21 1 1 2 2 22 1 1 2...
input:
2 4 1000 671 0 1 0 0 1 0 0 0 0 1 0 1 1 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
2 2 311 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 2 21 2 2 22 2 2 23 2 2 24 2 2 25 2 2 26 2 2 27 2 2 28 2 2 29 2 2 30 2 2 31 2 2 32 2 2 33 2 2 34 2 2 35 2 2 36 2 2 37 2 2 38 2 2 39 2 2 40 2 2 41 2 2 42 2 2 43 ...
result:
ok OK
Test #15:
score: 12
Accepted
time: 274ms
memory: 3856kb
input:
1 4 1000 1 820 2 820 3 820 4 820 5 820 6 820 7 820 8 820 9 820 10 820 11 820 12 820 13 820 14 820 15 820 16 820 17 820 18 820 19 820 20 820 21 820 22 820 23 820 24 820 25 820 26 820 27 820 28 820 29 820 30 820 31 820 32 820 33 820 34 820 35 820 36 820 37 820 38 820 39 820 40 820 41 820 42 820 43 820...
output:
1 1 311 1 2 1 3 1 1 2 1 5 1 1 2 1 6 1 1 2 1 9 1 1 2 1 10 1 1 2 2 3 1 1 2 2 5 1 1 2 2 6 1 1 2 2 9 1 1 2 2 10 1 1 2 3 3 1 1 2 3 5 1 1 2 3 6 1 1 2 3 9 1 1 2 3 10 1 1 2 4 3 1 1 2 4 5 1 1 2 4 6 1 1 2 4 9 1 1 2 4 10 1 1 2 5 3 1 1 2 5 5 1 1 2 5 6 1 1 2 5 9 1 1 2 5 10 1 1 2 6 3 1 1 2 6 5 1 1 2 6 6 1 1 2 6 9...
input:
2 4 1000 820 1 1 0 0 0 1 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
2 2 311 2 3 1 2 2 311 2 2 1 2 2 2 2 2 3 2 2 4 2 2 5 2 2 6 2 2 7 2 2 8 2 2 9 2 2 10 2 2 11 2 2 12 2 2 13 2 2 14 2 2 15 2 2 16 2 2 17 2 2 18 2 2 19 2 2 20 2 2 21 2 2 22 2 2 23 2 2 24 2 2 25 2 2 26 2 2 27 2 2 28 2 2 29 2 2 30 2 2 31 2 2 32 2 2 33 2 2 34 2 2 35 2 2 36 2 2 37 2 2 38 2 2 39 2 2 40 2 2 41 ...
result:
ok OK
Subtask #5:
score: 0
Wrong Answer
Test #16:
score: 0
Wrong Answer
time: 1ms
memory: 3692kb
input:
1 5 1000 1 296 1 974 2 414 3 777 4 158 4 918 5 535 5 799 5 952 6 290 7 17 7 420 8 223 9 600 10 743 11 189 11 239 11 530 11 619 12 27 12 451 13 580 14 165 15 552 15 753 16 883 16 936 17 292 17 398 17 904 18 355 18 678 19 807 20 577 21 392 21 744 22 600 23 582 23 717 23 915 24 70 24 254 24 492 25 115 ...
output:
input:
2 5 1000 274
output:
result:
wrong answer Solution didn't visit every node