QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#136037 | #1139. Stations | bashkort# | 0 | 50ms | 3832kb | C++20 | 1.9kb | 2023-08-06 19:13:43 | 2024-07-04 01:20:40 |
Judging History
stations
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
constexpr int X = 999;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
std::vector<int> labels(n);
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]);
}
int T = 0;
auto dfs = [&](auto self, int v, int par, int d) -> void {
if (d == 0) {
labels[v] = T;
}
T += 1;
for (int to: adj[v]) {
if (to != par) {
self(self, to, v, d ^ 1);
}
}
if (d) {
labels[v] = T;
}
T += 1;
};
dfs(dfs, 0, -1, 0);
labels[0] = 0;
return labels;
}
bool isp(int a, int b, int c, int d) {
return a <= c && b >= d;
}
int find_next_station(int s, int t, std::vector<int> c) {
for (int to : c) {
if (to == t) {
return to;
}
}
int mn = min({s, *min_element(c.begin(), c.end())});
int mx = max({s, *max_element(c.begin(), c.end())});
int l, r;
if (mn == s) {
r = mn + 1;
l = mn;
for (int to : c) {
if (to != mx) {
r = max(mx, r);
}
}
} else {
r = mx;
for (int to : c) {
if (to != mn) {
l = min(l, to);
}
}
}
if (l <= t && t <= r) {
if (mn == s) {
for (int to : c) {
if (to >= t) {
return to;
}
}
} else {
reverse(c.begin(), c.end());
for (int to : c) {
if (to <= t) {
return to;
}
}
}
} else {
return mn ^ mx ^ s;
}
assert(false);
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3832kb
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 0 14 4 12 6 16 18 10 8 2 3 0 4 2 998 0 1990 384 230 726 1034 1848 1844 86 104 1884 1684 138 1426 826 152 1766 488 898 1694 1350 1634 652 1526 620 1504 936 1180 1036 538 426 1374 1412 1512 1194 1874 672 326 1064 1306 1958 212 1906 242 532 1250 458 324 1840 696 1626 358 1304 790 802 1310 214 82 194...
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: 3540kb
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 0 1022 1990 2 512 1024 1534 256 510 766 1020 1278 1532 1788 1988 4 130 258 384 514 640 768 894 1026 1152 1280 1406 1536 1662 1790 1916 66 128 192 254 320 382 446 508 576 638 702 764 830 892 956 1018 1088 1150 1214 1276 1342 1404 1468 1530 1598 1660 1724 1786 1852 1914 1956 1986 6 36 68 98 132 16...
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
Stage 2: Program stations Runtime Error
Test #17:
score: 0
Stage 2: Program stations Runtime Error
input:
10 2 1000000 1 0 10000 1 0 0 1 0 0 0 1 1 1 0 0 0 1 1 0 1 1 1 0 0 0 1 1 1 0 0 1 0 0 0 1 1 0 1 1 0 1 1 1 0 0 1 0 0 0 1 1 1 0 0 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 0 1 1 1 0 0 0 1 1 0 1 1 1 0 0 1 0 0 1 0 0 0 1 1 1 0 0 1 0 0 1 0 0 0 1 1 1 0 0 1 0 0 0 1 1 0 1 1 1 0 0 0 1 1 1 0 0 1 0 0 0 1 1 1 0 0 0 1 1 1...
output:
2 0 2 997 0 1476 1300 578 1656 300 1202 1436 380 36 1068 114 1970 630 484 456 1920 1976 1682 1810 1566 1242 182 1290 172 1886 670 788 620 1328 1754 22 1652 340 1122 1352 396 226 82 706 1906 1570 604 1492 1588 588 920 958 1222 156 272 112 298 730 302 734 1910 798 1118 1012 586 568 612 864 1714 1792 1...
input:
output:
result:
Subtask #4:
score: 0
Stage 2: Program stations Runtime Error
Test #34:
score: 10
Accepted
time: 50ms
memory: 3712kb
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 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 2
input:
1 100000 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 2 0 1 0 2 0 1 0 2 0 1 0 0 2 1 2 2 0 1 0 0 2 1 2 2 0 1 0 0 2 1 2 0 2 1 2 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 2 0 1 0 2 0 1 0 0 2 1 2 0 2 1 2 2 0 1 0 0 2 1 2 0 2 1 2 2 0 1 0 2 0 1 0 2 0 1 0 2 0 1 0 2 0 1 0 0 2 1 2 2 0...
output:
0 2 2 0 2 0 0 0 0 0 2 0 2 0 2 2 2 0 0 2 0 2 2 0 0 2 2 0 2 2 0 0 0 0 0 2 0 2 0 0 0 2 2 0 2 2 2 2 0 0 2 2 0 0 0 2 2 0 2 2 0 2 2 0 0 0 2 0 2 2 2 2 2 2 0 2 0 2 2 2 0 0 0 0 2 0 0 2 0 2 2 0 2 2 2 0 0 0 2 2 2 0 2 0 0 2 0 2 0 2 2 0 0 2 0 0 0 2 2 2 0 0 0 2 2 0 0 2 2 2 0 2 0 2 0 2 2 2 2 0 0 0 0 2 0 0 2 0 0 0 ...
result:
ok
Test #35:
score: 10
Accepted
time: 42ms
memory: 3716kb
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 0 2 4 3 0 2 4 3 0 4 2 3 0 2 4 3 0 4 2 3 0 4 2 3 0 2 4 3 0 4 2 3 0 4 2 3 0 2 4
input:
1 75069 4 2 2 0 2 0 2 2 2 4 0 2 1 4 0 2 1 4 2 0 1 0 0 2 1 4 2 4 1 4 4 0 2 0 2 2 4 1 0 4 2 2 0 2 4 2 2 0 2 2 0 1 4 4 2 2 0 2 4 2 2 0 2 2 0 1 4 0 2 1 4 4 0 2 0 2 0 2 2 2 4 0 4 1 4 2 4 1 4 4 2 2 0 2 4 2 2 0 2 2 0 1 0 2 4 1 4 0 4 1 4 2 0 1 4 0 4 1 4 2 0 1 0 2 0 1 4 4 0 2 0 2 4 2 2 0 2 0 2 2 2 4 4 0 2 0 ...
output:
2 2 4 4 0 4 4 0 0 2 2 4 2 2 4 4 0 2 4 4 2 2 0 4 4 4 4 0 4 0 2 2 0 4 0 4 0 2 4 0 4 4 0 4 0 0 4 4 0 0 4 2 0 4 4 4 4 4 0 4 2 4 4 2 0 2 0 4 2 4 2 4 4 4 2 4 0 0 0 2 0 0 4 0 0 0 2 4 4 0 4 4 2 2 2 4 2 0 2 4 0 0 4 0 0 2 0 2 4 0 2 4 4 0 4 4 0 4 4 4 4 0 2 2 0 4 4 4 2 0 4 0 4 0 2 4 4 2 4 4 0 4 2 4 0 0 0 4 4 4 ...
result:
ok
Test #36:
score: 0
Stage 2: Program stations Runtime Error
input:
10 4 1000000000 3 1 2 0 1 0 6664 2 0 0 2 1 0 0 3 1 2 3 0 2 3 0 1 2 0 0 1 1 2 3 0 2 0 0 1 3 3 2 1 0 0 1 1 1 3 3 2 1 0 0 3 1 2 3 0 2 3 0 0 3 1 2 1 0 3 1 1 1 2 0 3 2 1 0 3 1 2 1 0 0 3 1 2 1 0 1 3 3 3 2 1 1 0 0 1 3 3 2 0 0 2 3 0 0 3 1 1 0 0 0 2 2 0 1 1 2 3 0 2 0 0 3 0 1 2 3 0 2 1 0 2 1 0 3 1 1 3 2 1 1 0...
output:
4 0 6 2 4 4 0 2 4 6 4 0 6 2 4 4 0 6 2 4 4 0 6 4 2 4 0 2 4 6 4 0 2 4 6 4 0 4 6 2 4 0 4 2 6 4 0 6 2 4
input:
output:
result:
Subtask #5:
score: 0
Stage 2: Program stations Runtime Error
Test #54:
score: 0
Stage 2: Program stations Runtime Error
input:
10 3 1000000000 1 0 2 1 7507 1 2 2 2 0 1 1 2 2 1 2 2 1 2 2 0 2 1 0 2 1 2 1 1 2 1 1 0 2 1 1 0 0 1 0 0 1 0 0 2 0 1 1 0 0 0 1 1 0 1 1 0 2 1 2 0 1 2 0 1 2 0 1 0 2 1 2 0 1 1 0 0 2 0 1 0 1 1 2 0 1 1 2 2 2 0 1 0 2 1 0 2 1 0 2 1 0 2 1 2 0 1 0 1 1 2 0 1 0 1 1 0 2 1 0 2 1 2 0 1 2 0 1 1 2 2 0 2 1 2 0 1 2 0 1 2...
output:
3 0 4 2 998 0 538 1882 1484 1278 140 1568 1136 1982 730 182 888 1962 918 834 1318 174 128 1124 52 588 318 1450 1638 1624 62 222 1250 1834 1564 1940 1252 1578 1382 740 460 642 922 1402 1916 12 702 1164 1338 1656 758 1142 986 458 316 480 76 630 54 410 498 976 1664 358 398 1822 858 656 896 552 74 1572 ...