QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#527578 | #7868. 天空度假山庄 | asupersalmon | 100 ✓ | 40ms | 4124kb | C++14 | 1.5kb | 2024-08-22 17:16:03 | 2024-08-22 17:16:03 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int N;
int K;
int main(){
scanf(" %d",&N);
scanf(" %d",&K);
int num = (N-1)/2;
long long int sum = 0;
vector<int> v;
vector<int> ans;
for(int i = 1; i <= K; i++){
v.push_back(i);
sum += i;
}
sum %= N;
if(K == 2){
ans = {2, N - 1};
}
else{
if(sum == 0){
ans.push_back(v.back() + 1);
v.pop_back();
while(!v.empty()){
ans.push_back(v.back());
v.pop_back();
}
}
else if(sum == 1){
while(!v.empty()){
ans.push_back(v.back());
v.pop_back();
}
}
else{
int fum = N + 1 - sum;
for(int i = K; i >= 1; i--,num--){
if(fum <= num - i){
v.pop_back();
ans.push_back(fum + i);
break;
}
else{
fum -= (num - i);
ans.push_back(num);
v.pop_back();
}
}
while(!v.empty()){
ans.push_back(v.back());
v.pop_back();
}
}
}
int p = 1;
for(int i = 1; i < N; i++){
for(int j = 0; j < K; j++){
p = (p + ans[j] - 1) % N + 1;
printf("%d ",p);
}
}
}
詳細信息
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 1ms
memory: 4076kb
input:
8216 1
output:
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 10...
result:
ok correct
Test #2:
score: 5
Accepted
time: 1ms
memory: 4112kb
input:
5166 2
output:
3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50 52 51 53 52 54 53 55 ...
result:
ok correct
Test #3:
score: 5
Accepted
time: 1ms
memory: 3824kb
input:
7445 2
output:
3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50 52 51 53 52 54 53 55 ...
result:
ok correct
Test #4:
score: 5
Accepted
time: 0ms
memory: 3820kb
input:
1295 2
output:
3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50 52 51 53 52 54 53 55 ...
result:
ok correct
Subtask #2:
score: 20
Accepted
Test #5:
score: 20
Accepted
time: 28ms
memory: 3816kb
input:
86132 9
output:
43066 86106 86113 86119 86124 86128 86131 1 2 43067 86107 86114 86120 86125 86129 86132 2 3 43068 86108 86115 86121 86126 86130 1 3 4 43069 86109 86116 86122 86127 86131 2 4 5 43070 86110 86117 86123 86128 86132 3 5 6 43071 86111 86118 86124 86129 1 4 6 7 43072 86112 86119 86125 86130 2 5 7 8 43073 ...
result:
ok correct
Test #6:
score: 20
Accepted
time: 38ms
memory: 3824kb
input:
73452 11
output:
36726 73409 73418 73426 73433 73439 73444 73448 73451 1 2 36727 73410 73419 73427 73434 73440 73445 73449 73452 2 3 36728 73411 73420 73428 73435 73441 73446 73450 1 3 4 36729 73412 73421 73429 73436 73442 73447 73451 2 4 5 36730 73413 73422 73430 73437 73443 73448 73452 3 5 6 36731 73414 73423 7343...
result:
ok correct
Test #7:
score: 20
Accepted
time: 22ms
memory: 3812kb
input:
23283 20
output:
11642 23114 23132 23149 23165 23180 23194 23207 23219 23230 23240 23249 23257 23264 23270 23275 23279 23282 1 2 11643 23115 23133 23150 23166 23181 23195 23208 23220 23231 23241 23250 23258 23265 23271 23276 23280 23283 2 3 11644 23116 23134 23151 23167 23182 23196 23209 23221 23232 23242 23251 2325...
result:
ok correct
Test #8:
score: 20
Accepted
time: 25ms
memory: 3772kb
input:
36944 17
output:
18472 36826 36841 36855 36868 36880 36891 36901 36910 36918 36925 36931 36936 36940 36943 1 2 18473 36827 36842 36856 36869 36881 36892 36902 36911 36919 36926 36932 36937 36941 36944 2 3 18474 36828 36843 36857 36870 36882 36893 36903 36912 36920 36927 36933 36938 36942 1 3 4 18475 36829 36844 3685...
result:
ok correct
Test #9:
score: 20
Accepted
time: 29ms
memory: 3816kb
input:
61927 10
output:
30964 61893 61901 61908 61914 61919 61923 61926 1 2 30965 61894 61902 61909 61915 61920 61924 61927 2 3 30966 61895 61903 61910 61916 61921 61925 1 3 4 30967 61896 61904 61911 61917 61922 61926 2 4 5 30968 61897 61905 61912 61918 61923 61927 3 5 6 30969 61898 61906 61913 61919 61924 1 4 6 7 30970 61...
result:
ok correct
Subtask #3:
score: 20
Accepted
Dependency #2:
100%
Accepted
Test #10:
score: 20
Accepted
time: 1ms
memory: 4112kb
input:
111 17
output:
56 104 8 22 35 47 58 68 77 85 92 98 103 107 110 1 2 57 105 9 23 36 48 59 69 78 86 93 99 104 108 111 2 3 58 106 10 24 37 49 60 70 79 87 94 100 105 109 1 3 4 59 107 11 25 38 50 61 71 80 88 95 101 106 110 2 4 5 60 108 12 26 39 51 62 72 81 89 96 102 107 111 3 5 6 61 109 13 27 40 52 63 73 82 90 97 103 10...
result:
ok correct
Test #11:
score: 20
Accepted
time: 0ms
memory: 3876kb
input:
462 86
output:
231 460 212 295 377 458 76 155 233 310 386 461 73 146 218 289 359 428 34 101 167 232 296 359 421 20 80 139 197 254 310 365 419 10 62 113 163 212 260 307 353 398 442 23 65 106 146 185 223 260 296 331 365 398 430 461 29 58 86 113 139 164 188 211 233 254 274 293 311 328 344 359 373 386 398 409 419 428 ...
result:
ok correct
Test #12:
score: 20
Accepted
time: 1ms
memory: 3816kb
input:
262 43
output:
131 189 230 8 47 85 122 158 193 227 260 30 61 91 120 148 175 201 226 250 11 33 54 74 93 111 128 144 159 173 186 198 209 219 228 236 243 249 254 258 261 1 2 132 190 231 9 48 86 123 159 194 228 261 31 62 92 121 149 176 202 227 251 12 34 55 75 94 112 129 145 160 174 187 199 210 220 229 237 244 250 255 ...
result:
ok correct
Test #13:
score: 20
Accepted
time: 4ms
memory: 3896kb
input:
672 125
output:
316 440 563 13 134 254 373 491 608 52 167 281 394 506 617 55 164 272 379 485 590 22 125 227 328 428 527 625 50 146 241 335 428 520 611 29 118 206 293 379 464 548 631 41 122 202 281 359 436 512 587 661 62 134 205 275 344 412 479 545 610 2 65 127 188 248 307 365 422 478 533 587 640 20 71 121 170 218 2...
result:
ok correct
Test #14:
score: 20
Accepted
time: 5ms
memory: 3820kb
input:
747 127
output:
218 344 469 593 716 91 212 332 451 569 686 55 170 284 397 509 620 730 92 200 307 413 518 622 725 80 181 281 380 478 575 671 19 113 206 298 389 479 568 656 743 82 167 251 334 416 497 577 656 734 64 140 215 289 362 434 505 575 644 712 32 98 163 227 290 352 413 473 532 590 647 703 11 65 118 170 221 271...
result:
ok correct
Test #15:
score: 20
Accepted
time: 2ms
memory: 4116kb
input:
404 72
output:
202 345 11 80 148 215 281 346 6 69 131 192 252 311 369 22 78 133 187 240 292 343 393 38 86 133 179 224 268 311 353 394 30 69 107 144 180 215 249 282 314 345 375 404 28 55 81 106 130 153 175 196 216 235 253 270 286 301 315 328 340 351 361 370 378 385 391 396 400 403 1 2 203 346 12 81 149 216 282 347 ...
result:
ok correct
Subtask #4:
score: 20
Accepted
Test #16:
score: 20
Accepted
time: 19ms
memory: 4104kb
input:
1777 229
output:
551 779 1006 1232 1457 1681 127 349 570 790 1009 1227 1444 1660 98 312 525 737 948 1158 1367 1575 5 211 416 620 823 1025 1226 1426 1625 46 243 439 634 828 1021 1213 1404 1594 6 194 381 567 752 936 1119 1301 1482 1662 64 242 419 595 770 944 1117 1289 1460 1630 22 190 357 523 688 852 1015 1177 1338 14...
result:
ok correct
Test #17:
score: 20
Accepted
time: 12ms
memory: 3824kb
input:
1129 229
output:
565 1128 318 544 769 993 87 309 530 750 969 58 275 491 706 920 4 216 427 637 846 1054 132 338 543 747 950 23 224 424 623 821 1018 85 280 474 667 859 1050 111 300 488 675 861 1046 101 284 466 647 827 1006 55 232 408 583 757 930 1102 144 314 483 651 818 984 20 184 347 509 670 830 989 18 175 331 486 64...
result:
ok correct
Test #18:
score: 20
Accepted
time: 40ms
memory: 3880kb
input:
4253 233
output:
2127 2977 3208 3438 3667 3895 4122 95 320 544 767 989 1210 1430 1649 1867 2084 2300 2515 2729 2942 3154 3365 3575 3784 3992 4199 152 357 561 764 966 1167 1367 1566 1764 1961 2157 2352 2546 2739 2931 3122 3312 3501 3689 3876 4062 4247 178 361 543 724 904 1083 1261 1438 1614 1789 1963 2136 2308 2479 2...
result:
ok correct
Test #19:
score: 20
Accepted
time: 25ms
memory: 3856kb
input:
2311 233
output:
706 938 1169 1399 1628 1856 2083 2309 223 447 670 892 1113 1333 1552 1770 1987 2203 107 321 534 746 957 1167 1376 1584 1791 1997 2202 95 298 500 701 901 1100 1298 1495 1691 1886 2080 2273 154 345 535 724 912 1099 1285 1470 1654 1837 2019 2200 69 248 426 603 779 954 1128 1301 1473 1644 1814 1983 2151...
result:
ok correct
Test #20:
score: 20
Accepted
time: 34ms
memory: 3800kb
input:
6712 114
output:
273 386 498 609 719 828 936 1043 1149 1254 1358 1461 1563 1664 1764 1863 1961 2058 2154 2249 2343 2436 2528 2619 2709 2798 2886 2973 3059 3144 3228 3311 3393 3474 3554 3633 3711 3788 3864 3939 4013 4086 4158 4229 4299 4368 4436 4503 4569 4634 4698 4761 4823 4884 4944 5003 5061 5118 5174 5229 5283 53...
result:
ok correct
Test #21:
score: 20
Accepted
time: 6ms
memory: 3836kb
input:
1050 114
output:
525 1024 86 197 307 416 524 631 737 842 946 1049 101 202 302 401 499 596 692 787 881 974 16 107 197 286 374 461 547 632 716 799 881 962 1042 71 149 226 302 377 451 524 596 667 737 806 874 941 1007 22 86 149 211 272 332 391 449 506 562 617 671 724 776 827 877 926 974 1021 17 62 106 149 191 232 272 31...
result:
ok correct
Test #22:
score: 20
Accepted
time: 27ms
memory: 3892kb
input:
1132 514
output:
566 1118 498 1009 387 896 272 779 153 658 30 533 1035 404 904 271 769 134 630 1125 487 980 340 831 189 678 34 521 1007 360 844 195 677 26 506 985 331 808 152 627 1101 442 914 253 723 60 528 995 329 794 126 589 1051 380 840 167 625 1082 406 861 183 636 1088 407 857 174 622 1069 383 828 140 583 1025 3...
result:
ok correct
Test #23:
score: 20
Accepted
time: 27ms
memory: 3836kb
input:
1130 514
output:
565 1128 560 1121 551 1110 538 1095 521 1076 500 1053 475 1026 446 995 413 960 376 907 271 764 126 617 1107 466 954 311 797 152 636 1119 471 952 302 781 129 606 1082 427 901 244 716 57 527 996 334 801 137 602 1066 399 861 192 652 1111 439 896 222 677 1 454 906 227 677 1126 444 891 207 652 1096 409 8...
result:
ok correct
Subtask #5:
score: 35
Accepted
Dependency #1:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Test #24:
score: 35
Accepted
time: 26ms
memory: 3836kb
input:
1151 564
output:
576 1150 572 1144 564 1134 552 1120 536 1102 516 1080 492 1054 464 1024 432 990 396 952 356 910 312 864 264 814 212 760 156 702 96 640 32 574 1115 504 1043 430 967 352 887 270 803 184 715 94 623 1151 527 1053 427 951 323 845 215 735 103 621 1138 503 1007 359 861 211 711 59 557 1054 399 894 237 730 7...
result:
ok correct
Test #25:
score: 35
Accepted
time: 24ms
memory: 4116kb
input:
1042 511
output:
521 1040 516 1033 507 1022 494 1007 477 988 456 965 431 938 402 907 369 872 332 833 291 790 246 743 197 692 144 637 87 578 26 515 1003 448 934 377 861 302 784 223 703 140 618 53 529 1004 436 909 339 810 238 707 133 591 6 462 917 329 782 192 643 51 500 948 353 799 202 646 47 489 930 328 767 163 600 1...
result:
ok correct
Test #26:
score: 35
Accepted
time: 27ms
memory: 3840kb
input:
1170 575
output:
585 1168 580 1161 571 1150 558 1135 541 1116 520 1093 495 1066 466 1035 433 1000 396 961 355 918 310 871 261 820 208 765 151 706 90 643 25 576 1126 505 1053 430 976 351 895 268 810 181 721 90 628 1165 531 1066 430 963 325 856 216 745 103 630 1156 511 1027 371 884 226 737 77 586 1094 431 937 272 776 ...
result:
ok correct
Test #27:
score: 35
Accepted
time: 33ms
memory: 3804kb
input:
1249 615
output:
625 1248 621 1242 613 1232 601 1218 585 1200 565 1178 541 1152 513 1122 481 1088 445 1050 405 1008 361 962 313 912 261 858 205 800 145 738 81 672 13 602 1190 528 1114 450 1034 368 950 282 862 192 770 95 662 1228 544 1108 422 984 296 856 166 724 32 588 1143 448 1001 304 855 156 705 4 551 1097 393 937...
result:
ok correct
Test #28:
score: 35
Accepted
time: 12ms
memory: 4088kb
input:
746 364
output:
373 744 368 737 359 726 346 711 329 692 308 669 283 642 254 611 221 576 184 537 143 494 98 447 49 396 742 341 685 282 624 219 559 152 490 81 417 6 340 673 259 590 174 503 85 412 738 317 641 218 540 115 435 8 326 643 213 528 96 409 721 286 596 159 467 28 334 639 197 500 56 357 657 210 508 59 355 650 ...
result:
ok correct
Test #29:
score: 35
Accepted
time: 18ms
memory: 3824kb
input:
1146 565
output:
573 1144 568 1137 559 1126 546 1111 529 1092 508 1069 483 1042 454 1011 421 976 384 937 343 894 298 847 249 796 196 741 139 682 78 619 13 552 1090 481 1017 406 940 327 859 244 774 157 685 66 592 1117 495 1018 394 915 289 808 180 697 67 582 1096 463 975 340 850 213 721 82 588 1093 451 954 310 811 165...
result:
ok correct
Test #30:
score: 35
Accepted
time: 7ms
memory: 4120kb
input:
554 265
output:
277 552 272 545 263 534 250 519 233 500 212 477 187 450 158 419 125 384 88 337 28 272 515 203 444 130 369 53 290 526 207 441 120 352 29 259 488 162 389 61 286 510 179 401 68 288 507 171 388 50 265 479 138 350 7 217 426 80 287 493 144 348 551 199 400 46 245 443 86 282 477 117 310 502 139 329 518 152 ...
result:
ok correct
Test #31:
score: 35
Accepted
time: 18ms
memory: 4124kb
input:
1061 519
output:
531 1060 527 1054 519 1044 507 1030 491 1012 471 990 447 964 419 934 387 900 351 862 311 820 267 774 219 724 167 670 111 612 51 550 1048 484 980 414 908 340 832 262 752 180 668 94 580 4 488 971 392 873 292 771 188 665 80 555 1029 441 913 323 793 201 669 75 541 1006 409 872 273 734 133 592 1050 446 9...
result:
ok correct
Test #32:
score: 35
Accepted
time: 1ms
memory: 4080kb
input:
173 78
output:
87 172 83 166 69 142 41 112 9 78 146 40 106 171 62 125 14 75 135 21 79 136 19 74 128 8 60 111 161 37 85 132 5 50 94 137 6 47 87 126 164 28 64 99 133 166 25 56 86 115 143 170 23 48 72 95 117 138 158 4 22 39 55 70 84 97 109 120 130 139 147 154 160 165 169 172 1 2 88 173 84 167 70 143 42 113 10 79 147 ...
result:
ok correct
Test #33:
score: 35
Accepted
time: 17ms
memory: 4120kb
input:
884 430
output:
442 882 437 875 428 864 415 849 398 830 377 807 352 780 314 729 259 672 200 611 137 546 70 477 883 404 808 327 729 246 646 161 559 72 468 863 373 766 274 665 171 560 64 451 837 338 722 221 603 100 480 859 353 730 222 597 87 460 832 319 689 174 542 25 391 756 236 599 77 438 798 273 631 104 460 815 28...
result:
ok correct
Test #34:
score: 35
Accepted
time: 27ms
memory: 4124kb
input:
1089 537
output:
545 1088 541 1082 533 1072 521 1058 505 1040 485 1018 461 992 433 962 401 928 365 890 325 848 281 802 233 752 181 698 125 640 65 578 1 512 1022 442 950 368 874 290 794 208 710 122 622 32 530 1027 434 929 334 827 230 721 122 604 1085 476 955 344 821 208 683 68 541 1013 395 865 245 713 91 557 1022 397...
result:
ok correct
Test #35:
score: 35
Accepted
time: 4ms
memory: 3788kb
input:
433 207
output:
217 432 213 426 205 416 193 402 177 384 157 362 133 333 93 285 43 233 422 177 364 117 302 53 236 418 166 346 92 270 14 190 365 106 279 18 189 359 95 263 430 163 328 59 222 384 112 272 431 156 313 36 191 345 65 217 368 85 234 382 96 242 387 98 241 383 91 231 370 75 212 348 50 184 317 16 147 277 406 1...
result:
ok correct