QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#135992 | #1139. Stations | bashkort# | 0 | 48ms | 4076kb | C++20 | 967b | 2023-08-06 17:14:46 | 2024-07-04 01:20:00 |
Judging History
stations
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
vector<vector<int>> adj(n);
for (int i = 0; i + 1 < n; ++i) {
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
std::vector<int> labels(n);
int T = 0;
auto dfs = [&](auto self, int v, int par) -> int {
int sz = 1;
for (int to : adj[v]) {
if (to != par) {
int t = self(self, to, v);
T += t;
sz += t;
}
}
labels[v] = T++;
return sz;
};
dfs(dfs, 0, -1);
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
pair<int, int> best{1e9, -1};
for (int to : c) {
if (abs(s - t) > abs(to - t)) {
best = min(best, pair{abs(to - t), to});
}
}
return best.second;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3728kb
input:
0 10 10 1000 4 5 9 0 2 6 5 2 8 3 1 4 8 1 6 0 3 7 3 1000 0 1 1 2 998 1000 166 178 393 452 389 179 622 429 892 866 872 18 899 227 835 637 587 769 504 386 369 577 65 441 523 17 803 221 878 321 637 892 696 473 16 146 840 322 495 986 353 275 330 585 831 402 719 810 704 830 780 940 53 901 894 911 394 482 ...
output:
10 46 11 29 4 16 22 37 2 7 0 3 5 2 0 998 328678 324788 13860 77 144383 40741 224749 222223 8910 6669 248203 134303 3320 46454 100333 2277 176164 289444 74809 139048 33268 112078 183418 72604 201994 65993 63428 24754 40378 254269 21735 36808 43591 68341 24341 241558 172328 5885 35716 28274 300484 27 ...
input:
1 -1 0
output:
result:
FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 0ms
memory: 3916kb
input:
0 10 996 1000 0 1 2 0 1 3 4 1 5 2 6 2 7 3 3 8 4 9 10 4 11 5 12 5 6 13 14 6 7 15 7 16 17 8 18 8 19 9 9 20 21 10 10 22 23 11 24 11 12 25 26 12 27 13 13 28 14 29 30 14 15 31 15 32 16 33 34 16 35 17 17 36 18 37 38 18 39 19 40 19 41 20 42 20 43 21 44 21 45 22 46 22 23 47 48 23 49 24 24 50 25 51 52 25 26 ...
output:
996 8946 4096 8461 1792 3840 6400 8232 768 1664 2816 3712 5376 6272 7424 8131 320 704 1216 1600 2368 2752 3264 3648 4928 5312 5824 6208 6976 7360 7872 8094 128 288 512 672 1024 1184 1408 1568 2176 2336 2560 2720 3072 3232 3456 3616 4736 4896 5120 5280 5632 5792 6016 6176 6784 6944 7168 7328 7680 784...
input:
1 -1 0
output:
result:
FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)
Subtask #3:
score: 0
Wrong Answer
Test #17:
score: 0
Wrong Answer
time: 38ms
memory: 3872kb
input:
0 10 2 1000000 1 0 997 1000000 830 513 223 672 727 200 763 415 581 440 34 42 267 325 912 693 753 59 401 289 198 641 982 214 41 49 453 107 940 806 905 732 153 482 248 405 102 79 480 837 534 620 564 856 679 178 278 247 899 206 333 672 297 308 407 863 26 752 272 178 204 603 208 10 715 562 785 285 184 5...
output:
2 2 0 997 382723 188190 95702 41040 314820 159329 57629 164450 117369 343205 21114 281624 379894 27494 72389 83435 375569 380581 335789 374953 247455 72009 232902 91377 239777 374056 18914 2925 29889 108344 379349 354902 311654 137549 33669 119804 109745 203840 306152 12560 374806 250277 33929 19813...
input:
1 59859 14 0 2 9 34 0 2 1 2 0 2 1 2 469964 419069 2 468995 470934 254225 187364 2 253519 254932 269030 9199 2 268297 269764 2 0 1 0 25 34 2 22 29 385880 226127 2 385002 386759 2 0 1 0 2 0 1 0 0 2 1 2 2 0 2 0 5 378728 238394 2 378628 378829 198134 310077 2 197505 198764 119804 123752 2 119315 120294 ...
output:
9 2 2 468995 253519 268297 0 29 385002 0 0 2 0 378628 198764 120294 9 2 162734 2619 97922 193459 373954 373849 0 15050 65702 18527 2 2 30380 34 104672 5 2 2 68654 227474 21547 0 120294 17765 394759 64260 2 5 7975 83844 4930 0 303032 5 151807 57955 344 1034 0 2279 5 2 2 14 14 995 183314 14534 2025 5 ...
result:
wrong answer Diff at 14-th number: read 378628 but expected 378829
Subtask #4:
score: 0
Wrong Answer
Test #34:
score: 10
Accepted
time: 48ms
memory: 3856kb
input:
0 10 2 1000000000 0 1 2 1000000000 0 1 2 1000000000 1 0 2 1000000000 1 0 2 1000000000 0 1 2 1000000000 1 0 2 1000000000 1 0 2 1000000000 0 1 2 1000000000 0 1 2 1000000000 0 1
output:
2 2 0 2 2 0 2 2 0 2 2 0 2 2 0 2 2 0 2 2 0 2 2 0 2 2 0 2 2 0
input:
1 100000 0 2 1 2 2 0 1 0 2 0 1 0 0 2 1 2 2 0 1 0 0 2 1 2 0 2 1 2 0 2 1 2 0 2 1 2 0 2 1 2 2 0 1 0 0 2 1 2 2 0 1 0 0 2 1 2 2 0 1 0 2 0 1 0 2 0 1 0 0 2 1 2 0 2 1 2 2 0 1 0 0 2 1 2 2 0 1 0 2 0 1 0 0 2 1 2 0 2 1 2 2 0 1 0 2 0 1 0 0 2 1 2 2 0 1 0 2 0 1 0 0 2 1 2 0 2 1 2 0 2 1 2 0 2 1 2 0 2 1 2 2 0 1 0 0 2...
output:
2 0 0 2 0 2 2 2 2 2 0 2 0 2 0 0 0 2 2 0 2 0 0 2 2 0 0 2 0 0 2 2 2 2 2 0 2 0 2 2 2 0 0 2 0 0 0 0 2 2 0 0 2 2 2 0 0 2 0 0 2 0 0 2 2 2 0 2 0 0 0 0 0 0 2 0 2 0 0 0 2 2 2 2 0 2 2 0 2 0 0 2 0 0 0 2 2 2 0 0 0 2 0 2 2 0 2 0 2 0 0 2 2 0 2 2 2 0 0 0 2 2 2 0 0 2 2 0 0 0 2 0 2 0 2 0 0 0 0 2 2 2 2 0 2 2 0 2 2 2 ...
result:
ok
Test #35:
score: 0
Wrong Answer
time: 40ms
memory: 4076kb
input:
0 10 3 1000000000 2 1 2 0 3 1000000000 1 0 2 0 3 1000000000 2 0 0 1 3 1000000000 0 2 1 2 3 1000000000 1 2 1 0 3 1000000000 1 0 2 1 3 1000000000 0 2 1 2 3 1000000000 1 2 1 0 3 1000000000 0 2 1 0 3 1000000000 2 0 1 2
output:
3 5 0 2 3 4 0 2 3 4 2 0 3 5 0 2 3 5 2 0 3 5 2 0 3 5 0 2 3 5 2 0 3 4 2 0 3 5 0 2
input:
1 75069 2 0 2 0 5 4 0 2 0 2 5 0 1 2 5 0 1 2 0 4 1 4 5 0 1 2 0 2 1 2 2 5 2 0 5 0 2 1 4 2 0 2 0 5 2 0 2 0 5 0 5 1 2 2 0 2 0 5 2 0 2 0 5 0 5 1 2 5 0 1 2 2 5 2 0 5 4 0 2 0 2 5 2 1 2 0 2 1 2 2 0 2 0 5 2 0 2 0 5 0 4 1 4 0 2 1 2 5 2 1 2 0 5 1 2 5 2 1 2 0 4 1 4 0 5 1 2 2 5 2 0 5 2 0 2 0 5 4 0 2 0 2 2 5 2 0 ...
output:
0 0 2 2 4 2 2 5 -1 0 0 2 0 0 2 2 5 0 2 2 0 0 4 2 2 2 2 4 2 5 0 0 5 2 4 2 5 0 2 -1 2 2 4 2 5 5 2 2 -1 5 2 0 5 2 2 2 2 2 4 2 0 2 2 0 4 0 4 2 0 2 0 2 2 2 0 2 5 4 4 0 -1 -1 2 -1 5 5 0 2 2 5 2 2 0 0 0 2 0 5 0 2 4 4 2 5 4 0 5 0 2 5 0 2 2 5 2 2 5 2 2 2 2 -1 0 0 4 2 2 2 0 5 2 5 2 -1 0 2 2 0 2 2 -1 2 0 2 -1 ...
result:
wrong answer Diff at 9-th number: read -1 but expected 4
Subtask #5:
score: 0
Wrong Answer
Test #54:
score: 0
Wrong Answer
time: 38ms
memory: 3784kb
input:
0 10 3 1000000000 1 0 2 1 998 1000000000 928 443 90 795 55 379 957 417 759 300 960 136 309 858 833 370 228 827 876 955 619 365 15 108 243 388 54 925 141 894 272 634 0 989 600 346 380 277 350 113 326 613 975 946 660 98 34 538 220 864 9 585 185 860 458 424 509 14 22 275 109 872 153 233 76 834 972 736 ...
output:
3 5 2 0 998 337318 241024 253811 61378 23989 2079 88804 23053 327061 132064 252 70049 311611 61094 88436 27929 464 2925 23911 11627 209099 6669 52283 117049 111008 10152 189 22183 222203 87338 295078 22286 92539 37561 127399 295819 177428 59968 41411 277594 18527 145658 21611 30499 125104 119254 226...
input:
1 59797 2 0 2 0 5 26105 9044 2 25877 26334 0 2 1 2 239 1328 2 223 256 37674 122474 2 37400 37949 5 9 2 2 9 5 0 2 2 9 250411 93679 2 249734 251089 120854 223967 2 120799 120910 100129 48004 2 99707 100552 2 0 1 0 33152 31124 2 32895 33410 66065 67160 2 65702 66429 301034 174643 2 300286 301783 2 5 2 ...
output:
0 25877 2 256 37949 9 2 249734 120910 99707 0 32895 66429 300286 5 233654 117369 2878 5 339899 1769 2 5 215455 119 4559 133342 290453 80939 0 5 309290 305404 2 276395 2518 6104 289244 568 2 2 0 152210 271879 2 6440 46664 9044 222599 7 0 860 24530 5 10 30134 49769 0 289388 5 0 158983 25 19 80199 7238...
result:
wrong answer Diff at 28-th number: read 290453 but expected 290556