QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#498961 | #1139. Stations | Dan4Life# | 0 | 0ms | 3952kb | C++23 | 991b | 2024-07-30 22:17:17 | 2024-07-30 22:17:17 |
stations
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
using ll = long long;
using vi = vector<int>;
const int mxN = 1010;
int dfs_timer = 0;
vi labels, adj[mxN];
void dfs(int s, int p){
for(auto u : adj[s])
if(u!=p) dfs(u,s);
labels[s] = dfs_timer++;
cout << s << " " << labels[s] << "\n";
}
vi label(int n, int k, vi u, vi v) {
labels.clear();
labels.resize(n,0); dfs_timer=0;
for(int i = 0; i < n; i++) adj[i].clear();
for(int i = 0; i < sz(u); i++){
int a = u[i], b = v[i];
adj[a].pb(b), adj[b].pb(a);
}
dfs(0,-1);
return labels;
}
int find_next_station(int s, int t, vi c) {
if(sz(c)==1) return c[0];
for(auto u : c) if(u==t) return u;
if(t > s) return c.back();
for(int i = 0; i < sz(c)-2; i++)
if(c[i] < t and t < c[i+1]) return c[i+1];
int sub0 = s-1-c[0];
if(c[0]-sub0+1 <= t and t < c[0]) return c[0];
return c.back();
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3920kb
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:
9 0 7 1 3 2 8 3 1 4 4 5 5 6 2 7 6 8 0 9 10 9 4 7 2 5 6 8 1 3 0 2 0 1 1 0 2 3 2 1 0 607 0 887 1 112 2 451 3 56 4 457 5 41 6 180 7 190 8 533 9 956 10 3 11 525 12 298 13 596 14 130 15 684 16 603 17 472 18 765 19 415 20 599 21 731 22 43 23 456 24 927 25 349 26 550 27 930 28 303 29 137 30 485 31 156 32 1...
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: 3952kb
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:
511 0 512 1 255 2 513 3 514 4 256 5 127 6 515 7 516 8 257 9 517 10 518 11 258 12 128 13 63 14 519 15 520 16 259 17 521 18 522 19 260 20 129 21 523 22 524 23 261 24 525 25 526 26 262 27 130 28 64 29 31 30 527 31 528 32 263 33 529 34 530 35 264 36 131 37 531 38 532 39 265 40 533 41 534 42 266 43 132 4...
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: 0ms
memory: 3952kb
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:
1 0 0 1 2 1 0 63 0 73 1 689 2 263 3 319 4 138 5 547 6 760 7 650 8 893 9 124 10 384 11 836 12 830 13 513 14 167 15 601 16 543 17 950 18 840 19 734 20 481 21 926 22 152 23 121 24 463 25 559 26 483 27 80 28 127 29 651 30 811 31 372 32 606 33 477 34 328 35 296 36 704 37 835 38 922 39 590 40 865 41 576 4...
input:
1 -1 0
output:
result:
FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)
Subtask #4:
score: 0
Wrong Answer
Test #34:
score: 0
Wrong Answer
time: 0ms
memory: 3696kb
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:
1 0 0 1 2 1 0 1 0 0 1 2 1 0 1 0 0 1 2 1 0 1 0 0 1 2 1 0 1 0 0 1 2 1 0 1 0 0 1 2 1 0 1 0 0 1 2 1 0 1 0 0 1 2 1 0 1 0 0 1 2 1 0 1 0 0 1 2 1 0
input:
1 -1 0
output:
result:
FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)
Subtask #5:
score: 0
Wrong Answer
Test #54:
score: 0
Wrong Answer
time: 0ms
memory: 3604kb
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:
2 0 1 1 0 2 3 2 1 0 700 0 767 1 556 2 795 3 90 4 339 5 949 6 311 7 993 8 839 9 912 10 421 11 846 12 198 13 866 14 664 15 745 16 934 17 26 18 786 19 564 20 10 21 406 22 945 23 214 24 95 25 513 26 288 27 472 28 16 29 997 30 249 31 922 32 313 33 104 34 440 35 526 36 933 37 769 38 361 39 865 40 529 41 2...
input:
1 -1 0
output:
result:
FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)