QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#499964 | #1139. Stations | Dan4Life | 0 | 48ms | 4084kb | C++23 | 1.0kb | 2024-07-31 20:32:38 | 2024-07-31 20:32:44 |
Judging History
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, int dep){
if(!dep) labels[s] = dfs_timer++;
for(auto u : adj[s])
if(u!=p) dfs(u,s,dep^1);
if(dep) labels[s] = dfs_timer++;
}
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, 0); 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(s < c[0]){
if(s<=t and t<=c.back())
return *lower_bound(all(c),t);
return c.back();
}
if(c[0]<=t and t<=s){
for(int i = 1; i < sz(c)-1; i++)
if(c[i]<=t and t<c[i+1]) return c[i];
return c.back();
}
return c[0];
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 36ms
memory: 3792kb
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 7 2 6 3 8 9 5 4 1 3 0 2 1 998 0 995 192 115 363 517 924 922 43 52 942 842 69 713 413 76 883 244 449 847 675 817 326 763 310 752 468 590 518 269 213 687 706 756 597 937 336 163 532 653 979 106 953 121 266 625 229 162 920 348 813 179 652 395 401 655 107 41 974 343 10 548 170 985 30 89 71 191 388 ...
input:
1 59784 0 1 1 1 574 618 2 842 843 0 1 1 1 848 310 2 151 152 2 1 1 1 1 0 1 0 0 1 1 1 742 153 2 674 675 1 0 2 2 3 0 3 1 3 474 416 2 525 526 9 2 2 0 2 223 888 2 195 196 934 400 2 65 66 732 49 2 112 113 285 437 2 714 715 0 1 1 1 69 52 2 76 77 2 1 2 0 1 0 1 1 1 647 63 2 568 569 1 0 1 0 37 862 2 570 571 0...
output:
1 842 1 152 1 0 1 674 3 3 526 2 195 66 112 714 1 77 1 1 568 0 571 1 2 307 1 0 0 348 24 861 1 9 93 0 405 27 8 3 9 168 579 998 18 767 895 475 80 80 2 43 150 1 2 2 1 614 2 2 0 0 726 194 467 6 242 0 0 351 450 234 131 0 216 272 2 1 991 1 1 470 2 87 2 11 81 570 9 9 9 2 1 2 1 170 217 473 2 383 394 312 0 80...
result:
wrong answer Diff at 378-th number: read 2 but expected 0
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 32ms
memory: 4080kb
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 511 995 1 256 512 767 128 255 383 510 639 766 894 994 2 65 129 192 257 320 384 447 513 576 640 703 768 831 895 958 33 64 96 127 160 191 223 254 288 319 351 382 415 446 478 509 544 575 607 638 671 702 734 765 799 830 862 893 926 957 978 993 3 18 34 49 66 81 97 112 130 145 161 176 193 208 224 23...
input:
1 50252 729 381 1 727 852 130 1 851 986 523 1 987 409 385 1 408 857 222 1 855 421 924 1 420 707 713 1 705 434 778 1 432 712 753 3 713 714 718 870 463 3 863 864 867 992 15 1 993 596 143 3 597 598 599 782 516 1 780 403 922 1 401 291 0 1 290 71 147 1 70 864 931 3 865 866 870 319 310 3 257 289 304 361 6...
output:
727 851 987 408 855 420 705 432 718 863 993 599 780 401 290 70 870 304 360 960 935 864 712 160 375 915 209 758 683 926 895 885 773 360 289 505 609 769 300 459 854 408 981 903 414 48 168 687 840 137 168 368 922 53 839 976 332 938 630 231 686 900 187 442 864 649 447 101 266 212 751 687 600 95 996 894 ...
result:
wrong answer Diff at 259-th number: read 703 but expected 512
Subtask #3:
score: 0
Wrong Answer
Test #17:
score: 0
Wrong Answer
time: 38ms
memory: 3884kb
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 0 1 997 0 738 650 289 828 150 601 718 190 18 534 57 985 315 242 228 960 988 841 905 783 621 91 645 86 943 335 394 310 664 877 11 826 170 561 676 198 113 41 353 953 785 302 746 794 294 460 479 611 78 136 56 149 365 151 367 955 399 559 506 293 284 306 432 857 896 688 923 400 546 1 286 21 431 5 646 5...
input:
1 59859 5 3 2 0 1 1 0 1 0 1 0 1 0 984 957 2 15 16 194 245 2 899 900 135 434 2 867 868 0 1 1 1 6 0 2 8 9 61 164 2 938 939 0 1 1 1 0 1 1 1 1 0 1 0 2 1 2 0 1 880 87 2 979 980 814 893 2 185 186 744 748 2 255 256 4 9 2 1 2 1 2 1 2 717 612 2 146 147 23 98 2 91 92 280 293 2 722 723 854 429 2 239 240 919 90...
output:
1 0 0 16 899 867 1 9 938 1 1 0 1 980 185 255 1 2 147 92 722 240 941 920 1 530 263 348 2 1 321 0 273 3 0 1 686 163 398 1 187 350 938 321 2 3 587 636 558 1 161 3 276 384 67 70 1 24 0 0 2 5 5 37 746 415 27 3 160 6 134 614 41 3 785 1 614 377 1 790 2 468 740 1 1 79 1 859 1 653 77 6 2 2 181 4 2 1 849 1 45...
result:
wrong answer Diff at 115-th number: read 6 but expected 0
Subtask #4:
score: 0
Wrong Answer
Test #34:
score: 10
Accepted
time: 48ms
memory: 4084kb
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 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1
input:
1 100000 1 0 1 0 0 1 1 1 0 1 1 1 1 0 1 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0 1 0 0 1 1 1 1 0 1 0 0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 0 1 0 1 0 0 1 1 1 1 0 1 0 0 1 1 1 0 1 1 1 1 0 1 0 1 0 1 0 0 1 1 1 0 1 1 1 1 0 1 0 0 1 1 1 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0...
output:
0 1 1 0 1 0 0 0 0 0 1 0 1 0 1 1 1 0 0 1 0 1 1 0 0 1 1 0 1 1 0 0 0 0 0 1 0 1 0 0 0 1 1 0 1 1 1 1 0 0 1 1 0 0 0 1 1 0 1 1 0 1 1 0 0 0 1 0 1 1 1 1 1 1 0 1 0 1 1 1 0 0 0 0 1 0 0 1 0 1 1 0 1 1 1 0 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 0 1 0 0 0 1 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 0 1 0 0 0 ...
result:
ok
Test #35:
score: 10
Accepted
time: 42ms
memory: 3844kb
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 1 2 3 0 1 2 3 0 2 1 3 0 1 2 3 0 2 1 3 0 2 1 3 0 1 2 3 0 2 1 3 0 2 1 3 0 1 2
input:
1 75069 2 1 2 0 1 0 1 2 1 2 0 1 1 2 0 1 1 2 1 0 1 0 0 1 1 2 1 2 1 2 2 0 2 0 1 1 2 1 0 2 1 2 0 1 2 1 2 0 1 1 0 1 2 2 1 2 0 1 2 1 2 0 1 1 0 1 2 0 1 1 2 2 0 2 0 1 0 1 2 1 2 0 2 1 2 1 2 1 2 2 1 2 0 1 2 1 2 0 1 1 0 1 0 1 2 1 2 0 2 1 2 1 0 1 2 0 2 1 2 1 0 1 0 1 0 1 2 2 0 2 0 1 2 1 2 0 1 0 1 2 1 2 2 0 2 0 ...
output:
1 1 2 2 0 2 2 0 0 1 1 2 1 1 2 2 0 1 2 2 1 1 0 2 2 2 2 0 2 0 1 1 0 2 0 2 0 1 2 0 2 2 0 2 0 0 2 2 0 0 2 1 0 2 2 2 2 2 0 2 1 2 2 1 0 1 0 2 1 2 1 2 2 2 1 2 0 0 0 1 0 0 2 0 0 0 1 2 2 0 2 2 1 1 1 2 1 0 1 2 0 0 2 0 0 1 0 1 2 0 1 2 2 0 2 2 0 2 2 2 2 0 1 1 0 2 2 2 1 0 2 0 2 0 1 2 2 1 2 2 0 2 1 2 0 0 0 2 2 2 ...
result:
ok
Test #36:
score: 0
Wrong Answer
time: 38ms
memory: 3820kb
input:
0 10 4 1000000000 3 1 2 0 1 0 4 1000000000 0 3 1 2 3 1 4 1000000000 3 1 0 2 0 1 4 1000000000 2 1 2 3 1 0 4 1000000000 3 1 0 1 2 3 4 1000000000 0 1 3 0 2 3 4 1000000000 2 0 3 0 1 2 4 1000000000 0 2 2 3 1 3 4 1000000000 3 2 2 1 3 0 4 1000000000 2 3 3 0 0 1
output:
4 0 3 1 2 4 0 1 2 3 4 0 3 1 2 4 0 3 1 2 4 0 3 2 1 4 0 1 2 3 4 0 1 2 3 4 0 2 3 1 4 0 2 1 3 4 0 3 1 2
input:
1 66804 0 1 2 2 3 0 1 2 2 3 3 0 2 0 2 0 3 1 3 0 2 2 1 3 3 2 2 0 2 1 2 2 2 3 3 1 2 0 1 0 1 1 3 2 3 2 0 1 0 3 2 1 3 3 0 2 0 2 1 3 2 2 3 1 0 1 0 3 0 2 0 1 1 2 1 0 1 0 1 0 3 2 2 0 2 1 3 2 2 3 2 1 1 1 1 2 2 2 3 3 0 1 0 0 3 1 3 3 2 2 0 1 2 1 1 1 3 1 2 0 2 3 0 2 0 1 2 1 1 1 2 1 1 1 0 1 2 1 3 3 2 2 0 2 2 3 ...
output:
2 2 0 3 3 2 2 1 3 0 3 0 3 0 0 0 0 2 3 1 2 0 3 1 1 2 0 1 1 1 2 1 1 0 3 3 3 3 3 1 0 1 3 1 3 0 3 3 3 1 2 2 1 2 2 1 1 3 2 0 3 0 3 2 1 0 3 1 3 3 3 0 3 3 2 0 2 0 0 1 1 3 3 3 2 0 1 3 1 1 0 1 1 0 3 3 3 1 0 3 1 0 2 1 1 3 1 3 3 1 2 0 3 0 0 0 3 1 2 2 3 1 3 3 2 1 1 1 2 3 2 0 3 3 1 3 2 1 2 2 2 3 3 0 0 0 1 0 3 3 ...
result:
wrong answer Diff at 26-th number: read 2 but expected 0
Subtask #5:
score: 0
Wrong Answer
Test #54:
score: 0
Wrong Answer
time: 30ms
memory: 3796kb
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 0 2 1 998 0 269 941 742 639 70 784 568 991 365 91 444 981 459 417 659 87 64 562 26 294 159 725 819 812 31 111 625 917 782 970 626 789 691 370 230 321 461 701 958 6 351 582 669 828 379 571 493 229 158 240 38 315 27 205 249 488 832 179 199 911 429 328 448 276 37 786 506 381 694 8 190 621 657 419 883...
input:
1 59797 1 2 2 2 3 266 313 2 493 494 1 0 1 0 64 32 2 48 49 107 782 2 380 381 3 0 2 0 1 3 2 2 0 1 262 410 2 938 939 770 971 2 715 716 782 707 2 360 361 0 1 1 1 508 504 2 251 252 561 197 2 198 199 974 877 2 226 227 2 0 2 0 1 905 604 2 237 238 742 541 2 257 258 19 26 2 93 94 5 6 2 6 7 912 677 2 87 88 47...
output:
2 493 0 48 381 0 1 938 715 361 1 252 198 227 0 238 258 93 6 88 529 0 3 524 109 547 826 905 773 1 0 107 188 2 751 22 47 873 72 0 2 1 614 932 0 436 652 313 515 5 1 53 490 0 8 622 537 1 889 3 1 338 3 9 300 54 3 625 116 2 5 909 99 421 912 675 1 461 591 684 2 66 2 3 7 693 607 305 1 3 159 2 5 280 1 1 993 ...
result:
wrong answer Diff at 386-th number: read 3 but expected 0