QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#236554 | #2810. Speedrun | Ahmed57# | 21 | 537ms | 3944kb | C++23 | 839b | 2023-11-04 05:47:54 | 2024-06-05 09:14:30 |
Judging History
speedrun
#include <bits/stdc++.h>
#include "speedrun.h"
using namespace std;
void setHintLen(int l);
void setHint(int i, int j, bool b);
int getLength();
bool getHint(int j);
bool goTo(int x);
vector<int> adj[1001];
void assignHints(int subtask,int N,int A[],int B[]){
setHintLen(N);
for(int i = 1;i<N;i++){
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
for(int i = 1;i<=N;i++){
for(int j = 0;j<adj[i].size();j++){
setHint(i,adj[i][j],1);
}
}
}
int vis[1001];
int n;
void dfs(int i){
vis[i] = 1;
for(int j = 1;j<=n;j++){
if(vis[j])continue;
if(getHint(j)){
goTo(j);
dfs(j);
goTo(i);
}
}
}
void speedrun(int subtask, int N, int start){
n = N;
dfs(start);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 21
Accepted
Test #1:
score: 21
Accepted
time: 416ms
memory: 3888kb
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 1 453 1 1 2 1 454 1 1 2 2 59 1 1 2 3 113 1 1 2 3 657 1 1 2 3 824 1 1 2 4 494 1 1 2 5 33 1 1 2 5 550 1 1 2 5 937 1 1 2 6 287 1 1 2 7 222 1 1 2 7 577 1 1 2 7 742 1 1 2 8 626 1 1 2 9 896 1 1 2 10 204 1 1 2 11 638 1 1 2 12 305 1 1 2 12 552 1 1 2 12 791 1 1 2 13 246 1 1 2 14 840 ...
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 1 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:
ok OK
Test #2:
score: 21
Accepted
time: 410ms
memory: 3896kb
input:
1 1 1000 1 723 1 992 2 372 2 542 3 692 4 692 5 693 5 807 6 390 6 829 7 692 8 692 9 692 10 692 11 692 12 692 13 692 14 692 15 228 15 844 16 692 17 419 17 663 18 692 19 105 19 930 20 692 21 324 21 974 22 692 23 366 23 525 24 692 25 195 25 641 26 692 27 434 27 734 28 692 29 692 30 332 30 540 31 692 32 ...
output:
1 1 1000 1 2 1 723 1 1 2 1 992 1 1 2 2 372 1 1 2 2 542 1 1 2 3 692 1 1 2 4 692 1 1 2 5 693 1 1 2 5 807 1 1 2 6 390 1 1 2 6 829 1 1 2 7 692 1 1 2 8 692 1 1 2 9 692 1 1 2 10 692 1 1 2 11 692 1 1 2 12 692 1 1 2 13 692 1 1 2 14 692 1 1 2 15 228 1 1 2 15 844 1 1 2 16 692 1 1 2 17 419 1 1 2 17 663 1 1 2 1...
input:
2 1 1000 856 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 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:
ok OK
Test #3:
score: 21
Accepted
time: 537ms
memory: 3800kb
input:
1 1 1000 1 14 1 139 1 817 1 975 2 840 2 993 3 207 4 367 4 847 4 977 5 18 6 9 6 667 7 135 7 389 7 474 7 595 8 296 8 535 9 970 10 337 11 648 11 899 12 266 12 414 13 207 13 922 14 620 14 936 15 44 16 984 17 459 17 825 17 902 18 511 18 535 19 872 20 522 20 717 21 234 21 426 21 515 21 609 22 488 22 869 2...
output:
1 1 1000 1 2 1 14 1 1 2 1 139 1 1 2 1 817 1 1 2 1 975 1 1 2 2 840 1 1 2 2 993 1 1 2 3 207 1 1 2 4 367 1 1 2 4 847 1 1 2 4 977 1 1 2 5 18 1 1 2 6 9 1 1 2 6 667 1 1 2 7 135 1 1 2 7 389 1 1 2 7 474 1 1 2 7 595 1 1 2 8 296 1 1 2 8 535 1 1 2 9 6 1 1 2 9 970 1 1 2 10 337 1 1 2 11 648 1 1 2 11 899 1 1 2 12...
input:
2 1 1000 938 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 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:
ok OK
Test #4:
score: 21
Accepted
time: 419ms
memory: 3944kb
input:
1 1 1000 1 504 1 638 1 792 1 941 2 133 3 664 4 188 4 341 4 685 5 385 5 561 5 881 6 961 7 413 7 584 7 906 7 907 8 662 9 267 9 320 9 606 9 627 10 795 10 926 11 45 11 88 12 926 13 202 13 435 13 621 13 872 14 570 14 598 14 656 14 821 15 880 16 26 16 171 16 765 16 910 17 347 18 980 19 419 20 74 20 294 20...
output:
1 1 1000 1 2 1 504 1 1 2 1 638 1 1 2 1 792 1 1 2 1 941 1 1 2 2 133 1 1 2 3 664 1 1 2 4 188 1 1 2 4 341 1 1 2 4 685 1 1 2 5 385 1 1 2 5 561 1 1 2 5 881 1 1 2 6 961 1 1 2 7 413 1 1 2 7 584 1 1 2 7 906 1 1 2 7 907 1 1 2 8 662 1 1 2 9 267 1 1 2 9 320 1 1 2 9 606 1 1 2 9 627 1 1 2 10 795 1 1 2 10 926 1 1...
input:
2 1 1000 84 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 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 ...
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:
ok OK
Subtask #2:
score: 0
Wrong Answer
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 3792kb
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 1000
input:
2 2 1000 651 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 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 #3:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 10ms
memory: 3820kb
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 1000
input:
2 3 1000 986 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 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 #4:
score: 0
Wrong Answer
Test #10:
score: 0
Wrong Answer
time: 8ms
memory: 3852kb
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 1000
input:
2 4 1000 196 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 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 #5:
score: 0
Wrong Answer
Test #16:
score: 0
Wrong Answer
time: 18ms
memory: 3884kb
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:
1 1 1000
input:
2 5 1000 274 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 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