QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#498976 | #1139. Stations | Dan4Life# | 0 | 48ms | 4072kb | C++23 | 1001b | 2024-07-30 22:29:51 | 2024-07-30 22:29:51 |
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){
for(auto u : adj[s])
if(u!=p) dfs(u,s);
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);
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();
bool ok = (c.back()>s);
for(int i = 0; i < sz(c)-2+ok; i++)
if(c[i] < t and t < c[i+1]) return c[i+1];
if(ok) return c[0];
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: 36ms
memory: 3744kb
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 9 4 7 2 5 6 8 1 3 0 3 2 1 0 998 997 992 165 11 707 399 850 846 132 114 886 686 80 428 607 66 768 945 535 696 352 636 781 528 813 506 497 253 397 895 207 376 414 514 239 876 761 107 369 308 960 6 908 23 901 252 975 105 842 737 628 139 306 643 631 312 4 136 950 747 198 337 121 972 158 40 76 163 657...
input:
1 59784 1 0 1 0 686 598 2 685 687 1 0 1 0 696 379 2 695 697 0 1 1 1 0 1 1 1 1 0 1 0 485 112 2 484 486 1 3 2 0 2 3 2 1 2 51 167 2 50 52 8 7 2 7 9 27 777 2 26 28 868 199 2 867 869 619 746 2 618 620 429 125 2 428 430 1 0 1 0 53 87 2 52 54 1 0 2 0 2 1 0 1 0 296 92 2 295 297 0 1 1 1 533 724 2 532 534 1 0...
output:
0 685 0 695 1 1 0 484 2 2 52 7 28 867 620 428 0 54 0 0 295 1 534 0 1 6 1 1 2 737 1 722 1 8 84 1 391 7 6 2 8 508 550 996 10 536 788 105 447 60 1 521 699 1 1 1 1 606 1 7 2 1 607 456 65 34 65 3 1 283 292 965 582 1 412 63 1 1 985 0 1 332 1 433 1 24 837 692 8 8 8 1 44 7 1 267 410 338 1 158 211 375 1 761 ...
result:
wrong answer Diff at 8-th number: read 484 but expected 486
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 32ms
memory: 4040kb
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 995 510 994 254 509 765 993 126 253 381 508 637 764 892 992 62 125 189 252 317 380 444 507 573 636 700 763 828 891 955 991 30 61 93 124 157 188 220 251 285 316 348 379 412 443 475 506 541 572 604 635 668 699 731 762 796 827 859 890 923 954 975 990 14 29 45 60 77 92 108 123 141 156 172 187 204 21...
input:
1 50252 724 377 1 725 847 141 1 849 982 518 1 983 404 396 1 406 852 218 1 853 416 919 1 418 702 708 1 703 429 773 1 430 710 748 3 708 709 714 866 474 3 862 865 874 988 10 1 989 594 138 3 592 593 595 777 511 1 778 398 920 1 399 286 995 1 288 66 142 1 68 862 929 3 860 861 866 316 305 3 300 315 317 356...
output:
725 849 983 406 853 418 703 430 714 862 989 592 778 399 288 68 866 315 358 958 933 862 710 157 373 913 207 756 681 923 907 875 771 358 288 503 607 775 298 457 850 406 978 893 410 44 164 686 838 133 164 366 920 51 829 968 330 936 626 227 676 898 185 440 862 647 507 99 264 210 749 698 598 91 977 859 8...
result:
wrong answer Diff at 10-th number: read 862 but expected 874
Subtask #3:
score: 0
Wrong Answer
Test #17:
score: 0
Wrong Answer
time: 28ms
memory: 4072kb
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 1 0 997 996 612 436 285 792 563 338 572 483 827 204 749 973 233 379 407 923 979 818 912 702 378 681 426 691 889 193 75 243 464 968 841 788 523 258 488 467 637 781 157 909 706 259 628 724 275 56 94 358 707 591 751 565 133 561 129 913 65 254 148 277 295 251 0 850 930 512 876 63 228 861 291 821 1 853...
input:
1 59859 4 0 2 3 9 0 1 1 1 0 1 1 1 968 914 2 967 969 800 698 2 799 801 737 139 2 736 738 1 0 1 0 7 9 2 6 8 877 671 2 876 878 1 0 1 0 1 0 1 0 0 1 1 1 1 0 2 0 2 962 689 2 961 963 628 786 2 627 629 488 496 2 487 489 2 8 2 1 3 0 1 1 1 570 360 2 569 571 83 96 2 82 84 447 421 2 446 448 709 330 2 708 710 88...
output:
3 1 1 967 799 736 0 8 876 0 0 1 0 961 629 489 3 1 569 84 446 708 885 880 0 172 361 191 1 1 245 9 461 2 1 1 374 673 211 0 489 187 895 357 1 2 175 408 117 0 866 2 636 420 34 44 0 79 2 1 1 4 4 55 604 169 75 2 679 7 731 340 47 2 572 1 227 245 0 716 1 71 480 0 0 705 0 719 0 306 54 5 1 1 826 2 1 0 699 0 9...
result:
wrong answer Diff at 14-th number: read 961 but expected 963
Subtask #4:
score: 0
Wrong Answer
Test #34:
score: 10
Accepted
time: 48ms
memory: 3792kb
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 1 0 2 1 0 2 1 0 2 1 0 2 1 0 2 1 0 2 1 0 2 1 0 2 1 0 2 1 0
input:
1 100000 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 0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 0 0 1 1 1 1 0 1 0 0 1 1 1 1 0 1 0 1 0 1 0 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 0 1 1 1 0 1 1 1 1 0 1 0 1 0 1 0 0 1 1 1 1 0 1 0 1 0 1 0 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 0 0 1...
output:
1 0 0 1 0 1 1 1 1 1 0 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 0 1 0 0 1 1 1 1 1 0 1 0 1 1 1 0 0 1 0 0 0 0 1 1 0 0 1 1 1 0 0 1 0 0 1 0 0 1 1 1 0 1 0 0 0 0 0 0 1 0 1 0 0 0 1 1 1 1 0 1 1 0 1 0 0 1 0 0 0 1 1 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 1 1 0 0 0 1 1 1 0 0 1 1 0 0 0 1 0 1 0 1 0 0 0 0 1 1 1 1 0 1 1 0 1 1 1 ...
result:
ok
Test #35:
score: 10
Accepted
time: 40ms
memory: 3816kb
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 2 0 1 3 2 0 1 3 2 1 0 3 2 0 1 3 2 1 0 3 2 1 0 3 2 0 1 3 2 1 0 3 2 1 0 3 2 0 1
input:
1 75069 1 0 2 0 2 2 0 2 0 1 2 0 1 1 2 0 1 1 0 2 1 2 2 0 1 1 0 1 1 1 1 2 2 0 2 0 1 1 2 1 0 2 0 2 1 0 2 0 2 0 2 1 1 1 0 2 0 2 1 0 2 0 2 0 2 1 1 2 0 1 1 1 2 2 0 2 2 0 2 0 1 2 1 1 1 0 1 1 1 1 0 2 0 2 1 0 2 0 2 0 2 1 2 0 1 1 1 2 1 1 1 0 2 1 1 2 1 1 1 0 2 1 2 0 2 1 1 1 2 2 0 2 1 0 2 0 2 2 0 2 0 1 1 2 2 0 ...
output:
0 0 1 1 2 1 1 2 2 0 0 1 0 0 1 1 2 0 1 1 0 0 2 1 1 1 1 2 1 2 0 0 2 1 2 1 2 0 1 2 1 1 2 1 2 2 1 1 2 2 1 0 2 1 1 1 1 1 2 1 0 1 1 0 2 0 2 1 0 1 0 1 1 1 0 1 2 2 2 0 2 2 1 2 2 2 0 1 1 2 1 1 0 0 0 1 0 2 0 1 2 2 1 2 2 0 2 0 1 2 0 1 1 2 1 1 2 1 1 1 1 2 0 0 2 1 1 1 0 2 1 2 1 2 0 1 1 0 1 1 2 1 0 1 2 2 2 1 1 1 ...
result:
ok
Test #36:
score: 0
Wrong Answer
time: 30ms
memory: 3740kb
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 3 2 0 1 4 3 1 0 2 4 3 2 0 1 4 3 2 1 0 4 3 2 0 1 4 3 0 1 2 4 3 0 1 2 4 3 0 2 1 4 3 0 1 2 4 3 2 0 1
input:
1 66804 3 0 2 1 2 3 0 2 1 2 2 3 2 1 3 3 2 1 2 3 1 2 0 2 2 1 2 1 3 1 0 2 0 2 2 1 2 1 3 3 1 1 2 1 2 2 0 3 3 2 2 0 2 2 3 2 1 3 1 2 2 0 2 0 3 1 3 2 3 2 1 3 0 1 1 3 0 3 1 3 2 1 2 1 3 1 2 2 0 2 0 1 1 1 1 0 2 0 2 2 3 1 3 3 2 1 2 2 0 2 1 3 0 1 1 1 2 0 2 1 3 2 3 2 1 3 0 1 1 1 0 1 1 1 3 0 2 0 2 2 1 2 1 3 0 2 ...
output:
2 2 3 2 2 1 0 1 2 3 2 3 2 3 3 3 3 1 2 1 0 3 2 1 1 1 3 1 1 0 1 1 1 3 2 2 2 2 2 0 3 1 2 1 2 3 2 2 2 1 1 1 0 1 1 1 1 2 0 3 2 3 2 1 1 3 2 0 2 2 2 3 2 2 1 3 1 3 3 1 1 2 2 2 1 3 1 2 1 1 3 1 1 3 2 2 2 1 3 2 0 3 0 1 1 2 0 2 2 1 1 3 2 3 3 3 2 0 1 0 2 1 2 2 2 1 1 1 1 2 0 3 2 2 1 2 1 1 1 1 0 2 2 3 3 3 1 3 2 2 ...
result:
wrong answer Diff at 1-th number: read 2 but expected 1
Subtask #5:
score: 0
Wrong Answer
Test #54:
score: 0
Wrong Answer
time: 36ms
memory: 3812kb
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 2 1 0 998 997 865 884 486 280 63 570 267 984 673 21 515 964 485 569 320 29 75 279 151 815 114 452 640 626 141 18 252 836 566 942 254 580 384 663 943 761 481 404 918 191 701 239 340 658 645 261 417 945 112 923 127 773 149 993 905 427 666 154 194 824 545 747 507 851 129 574 391 641 390 187 176 244 3...
input:
1 59797 1 0 2 0 2 227 133 2 226 228 0 1 1 1 28 61 2 27 29 273 565 2 272 274 2 3 2 1 3 2 0 2 1 3 879 583 2 878 880 541 943 2 540 542 567 417 2 566 568 1 0 1 0 256 248 2 255 257 362 365 2 361 363 950 756 2 949 951 1 2 2 0 2 813 211 2 812 814 484 82 2 483 485 87 73 2 86 88 3 2 2 2 4 824 354 2 823 825 5...
output:
0 226 1 29 274 3 1 878 542 566 0 255 363 949 2 812 483 86 2 823 58 1 2 924 14 94 653 808 548 0 2 785 912 1 742 81 109 769 42 1 1 0 742 867 1 112 304 133 940 3 0 40 220 2 4 244 314 0 778 2 0 727 7 6 399 379 2 253 255 9 3 821 801 354 824 352 0 77 221 608 1 71 1 2 4 626 454 793 0 2 114 1 3 439 0 0 987 ...
result:
wrong answer Diff at 28-th number: read 808 but expected 810