QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#267307 | #7868. 天空度假山庄 | Lynkcat | 100 ✓ | 616ms | 187064kb | C++20 | 2.7kb | 2023-11-27 07:19:10 | 2023-11-27 07:19:10 |
Judging History
answer
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) (int)((x).size())
// #define int ll
//#define N
using namespace std;
bool vis[333335];
unordered_map<int,bool>f[333335];
bool bl[5005][5005];
int ans[1000005];
int n,m;
mt19937_64 rnd(time(0));
inline bool has(int x,int y)
{
if (n>5000)
{
if (f[x].count(y)||f[y].count(x)) return 1;
return 0;
}
return (bl[x][y]||bl[y][x]);
}
inline void add(int x,int y)
{
if (n>5000) f[x][y]=1;
else
bl[x][y]=1;
}
inline void del(int x,int y)
{
if (n>5000) f[x].erase(y);
else
bl[x][y]=0;
}
void dfs(int k,int len)
{
// assert(len<100000);
// cout<<k<<" "<<len<<endl;
if (len%m==0)
{
if (vis[k]) return;
vis[k]=1;
}
if (len==1ll*m*(n-1))
{
for (int i=1;i<=len;i++) cout<<ans[i]<<" ";cout<<endl;
// cout<<"ha"<<endl;
// for (int i=1;i<=n;i++)
// {
// for (int j=1;j<=n;j++)
// cout<<f[i][j];
// cout<<'\n';
// }
// for (int i=1;i<=n;i++) cout<<vis[i]<<" ";
// cout<<'\n';
exit(0);
}
poly g;
int t=0;
while (t<=1000ll)
{
++t;
int u=rnd()%n+1;
if (u==k||has(k,u)||u==k) continue;
// f[k][u]=1;
add(k,u);
ans[len+1]=u;
dfs(u,len+1);
del(k,u);
}
if (len%m==0)
{
vis[k]=0;
}
}
void BellaKira()
{
cin>>n>>m;
if (m==1)
{
for (int i=2;i<=n;i++) cout<<i<<" ";
cout<<'\n';
return;
}
if (m==2)
{
for (int i=2;i<=n;i++)
{
cout<<i%n+1<<" ";
cout<<i<<" ";
}
cout<<'\n';
return;
}
if (m==3)
{
int x=0;
for (int i=2;i<=n;i++)
{
cout<<(x+4)%n+1<<" ";
cout<<(x+2)%n+1<<" ";
cout<<(x+1)%n+1<<" ";
x=(x+1)%n;
}
return;
}
if (m==4)
{
int x=0;
for (int i=2;i<=n;i++)
{
cout<<(x+8)%n+1<<" ";
cout<<(x+4)%n+1<<" ";
cout<<(x+2)%n+1<<" ";
cout<<(x+1)%n+1<<" ";
x=(x+1)%n;
}
return;
}
if (m==5)
{
int x=0;
for (int i=2;i<=n;i++)
{
cout<<(x+16)%n+1<<" ";
cout<<(x+8)%n+1<<" ";
cout<<(x+4)%n+1<<" ";
cout<<(x+2)%n+1<<" ";
cout<<(x+1)%n+1<<" ";
x=(x+1)%n;
}
return;
}
if (m==6)
{
int x=0;
for (int i=2;i<=n;i++)
{
cout<<(x+32)%n+1<<" ";
cout<<(x+16)%n+1<<" ";
cout<<(x+8)%n+1<<" ";
cout<<(x+4)%n+1<<" ";
cout<<(x+2)%n+1<<" ";
cout<<(x+1)%n+1<<" ";
x=(x+1)%n;
}
return;
}
dfs(1,0);
}
signed main()
{
IOS;
cin.tie(0);
int T=1;
while (T--)
{
BellaKira();
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 3ms
memory: 21948kb
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: 0
Accepted
time: 0ms
memory: 23488kb
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: 0
Accepted
time: 2ms
memory: 22456kb
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: 0
Accepted
time: 6ms
memory: 21864kb
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: 616ms
memory: 169092kb
input:
86132 9
output:
47663 78007 44973 78362 74911 42506 17927 46052 21052 4520 64226 12997 47261 7648 61373 74393 19468 24674 71185 60824 51665 26368 28590 70491 57336 59192 50182 52400 65639 63231 48507 81602 2260 23106 38912 37744 36863 30527 75709 58767 39596 83179 10830 52096 33825 14590 25586 64019 40505 73968 824...
result:
ok correct
Test #6:
score: 0
Accepted
time: 587ms
memory: 176484kb
input:
73452 11
output:
471 69282 58338 67003 44911 5289 62966 14815 57663 49421 36463 23290 66029 47138 55627 33324 63516 66232 36667 58367 9660 61399 63819 6936 55680 8132 14126 62985 67612 19115 33193 39936 2351 41333 44556 46210 71299 55088 49322 16073 21164 42001 23204 47448 50072 24562 72924 9431 23821 1018 47564 315...
result:
ok correct
Test #7:
score: 0
Accepted
time: 195ms
memory: 111304kb
input:
23283 20
output:
21181 16385 16914 22192 12680 20220 14725 8203 14945 9586 22915 20413 2135 11003 16794 681 13713 22002 13030 5986 16388 2598 13831 13486 11172 10744 15529 12046 22468 9738 18072 10582 9822 15326 8949 5443 20967 22087 2664 7156 2368 3377 17682 20239 3562 12214 635 3437 5695 20487 6651 3580 11239 8701...
result:
ok correct
Test #8:
score: 0
Accepted
time: 300ms
memory: 143800kb
input:
36944 17
output:
14168 22560 18276 35450 19508 21513 14430 34290 22046 27592 24880 24283 9521 15336 10081 8371 13694 23875 28755 22675 21288 9993 36568 24302 10370 13195 745 7478 15403 17987 11294 14963 2622 33430 35173 28285 5625 26435 25259 28949 22044 36845 16764 6500 20495 30653 24986 11159 24712 4748 19697 1327...
result:
ok correct
Test #9:
score: 0
Accepted
time: 360ms
memory: 139948kb
input:
61927 10
output:
12900 60041 54510 18739 35520 42403 24978 15631 15033 47721 18168 20948 38513 51909 2620 55597 45344 48409 3628 17111 15743 59535 5817 40146 32681 44016 59283 50914 30624 33540 37424 33267 32557 1873 45362 51630 61642 57357 11197 35195 49219 36676 21983 146 53562 25413 44792 37197 8751 44234 19412 5...
result:
ok correct
Subtask #3:
score: 20
Accepted
Dependency #2:
100%
Accepted
Test #10:
score: 20
Accepted
time: 3ms
memory: 24100kb
input:
111 17
output:
102 4 84 44 97 19 40 27 22 26 17 6 79 43 97 103 92 14 88 48 102 33 37 60 26 45 44 77 5 105 7 55 90 29 7 33 89 79 7 89 104 52 83 9 29 92 82 75 60 77 4 111 28 96 92 51 57 92 70 101 18 50 11 60 80 53 16 25 63 23 89 94 4 90 64 100 66 41 35 10 99 8 105 22 19 38 4 83 63 59 48 25 91 37 35 67 42 83 84 68 30...
result:
ok correct
Test #11:
score: 0
Accepted
time: 3ms
memory: 30180kb
input:
462 86
output:
264 229 186 449 424 148 196 93 136 140 446 150 154 205 415 46 55 194 398 121 132 96 135 67 291 206 381 2 416 5 180 220 424 138 56 349 84 56 391 49 65 146 376 143 360 389 239 289 336 426 251 346 264 40 42 194 402 252 161 235 53 434 174 371 35 105 11 398 262 301 72 17 248 460 202 345 313 376 27 62 329...
result:
ok correct
Test #12:
score: 0
Accepted
time: 8ms
memory: 26376kb
input:
262 43
output:
64 157 76 217 110 118 138 49 186 6 36 244 6 169 189 204 117 36 42 173 14 258 125 81 109 18 183 198 222 257 254 246 142 136 64 93 104 12 257 51 111 140 44 125 76 81 43 243 16 96 121 94 122 170 210 130 180 104 135 73 257 168 210 105 133 69 51 92 66 247 246 97 58 76 98 151 167 140 185 124 53 146 129 18...
result:
ok correct
Test #13:
score: 0
Accepted
time: 7ms
memory: 38320kb
input:
672 125
output:
600 649 228 29 424 568 28 219 10 602 404 528 238 457 373 424 181 320 314 289 552 642 597 571 165 374 171 632 500 341 306 640 88 138 644 223 42 644 181 595 107 62 250 311 612 179 323 121 84 426 251 304 96 460 462 152 150 420 77 655 473 266 552 329 665 189 137 146 262 259 240 479 80 334 34 471 187 376...
result:
ok correct
Test #14:
score: 0
Accepted
time: 8ms
memory: 39576kb
input:
747 127
output:
327 694 606 167 7 535 235 132 328 419 698 612 313 304 160 556 667 56 734 178 522 9 300 601 372 68 564 614 689 443 498 634 82 195 476 454 78 23 238 517 14 656 508 44 225 677 680 493 693 207 116 268 741 556 36 431 15 189 494 490 734 419 81 83 743 630 725 584 670 454 6 203 506 403 439 402 208 610 603 1...
result:
ok correct
Test #15:
score: 0
Accepted
time: 7ms
memory: 29912kb
input:
404 72
output:
304 329 84 297 276 56 244 363 326 402 288 120 334 77 89 244 281 256 386 341 144 338 5 107 201 338 207 160 44 365 350 280 28 106 144 79 90 20 341 271 211 250 322 15 220 287 155 117 124 138 347 76 292 248 198 72 58 400 45 99 133 314 208 269 297 125 145 310 218 395 228 259 396 162 282 227 95 308 7 168 ...
result:
ok correct
Subtask #4:
score: 20
Accepted
Test #16:
score: 20
Accepted
time: 35ms
memory: 91384kb
input:
1777 229
output:
1707 1769 1314 963 340 1222 323 1149 152 361 563 1770 333 1123 796 596 1758 133 1576 700 836 937 537 1180 277 63 1679 678 692 137 1086 842 1383 1077 22 120 1140 1406 92 1632 696 1376 311 1395 35 592 1359 1549 1311 1274 1137 1545 801 326 417 1458 109 1147 1103 191 1776 441 908 1314 1506 540 1242 1365...
result:
ok correct
Test #17:
score: 0
Accepted
time: 23ms
memory: 67304kb
input:
1129 229
output:
753 589 187 769 1000 717 735 244 676 336 870 562 682 1066 398 444 185 356 683 950 1006 45 820 808 693 632 767 844 1066 471 306 209 820 103 386 528 305 468 1040 405 861 657 402 667 11 731 1042 778 392 535 944 1113 876 366 446 351 562 661 166 359 221 613 725 381 15 277 667 338 590 573 300 763 467 847 ...
result:
ok correct
Test #18:
score: 0
Accepted
time: 79ms
memory: 187064kb
input:
4253 233
output:
3490 20 3610 1410 1041 1309 3343 4210 1297 50 1794 4198 1319 2498 1892 2706 1536 1949 3076 1815 1337 3755 3222 3025 2180 1957 2733 4027 1922 842 3752 4244 2825 962 2441 2255 3178 2306 1429 2137 1545 1207 3601 2954 1061 3843 2717 926 2922 1042 10 2096 3401 1776 263 2182 1389 1504 2392 401 4058 1988 2...
result:
ok correct
Test #19:
score: 0
Accepted
time: 35ms
memory: 112544kb
input:
2311 233
output:
765 1020 588 62 1689 1483 1775 2021 2066 1541 1868 1606 2230 1448 1041 1450 2296 380 928 1999 773 930 1508 1458 802 2178 2007 898 2041 1783 1841 451 1 635 1718 728 1293 335 612 1876 813 1709 186 2270 1131 228 1185 440 1164 61 1632 500 606 158 1817 358 407 551 2288 2212 2063 1531 534 1063 9 771 1926 ...
result:
ok correct
Test #20:
score: 0
Accepted
time: 307ms
memory: 164632kb
input:
6712 114
output:
4132 3151 4970 465 5621 5135 3404 2136 3235 5734 5872 3790 5235 707 3875 208 103 3221 5935 3550 1477 90 851 6584 5136 6158 2851 2092 3523 2644 2879 4852 5559 2655 5426 5165 326 6199 1176 3418 3458 5535 5033 6154 944 4577 5325 3457 5867 4834 3377 5873 4416 4820 3304 4287 3831 1984 1505 315 1450 4662 ...
result:
ok correct
Test #21:
score: 0
Accepted
time: 8ms
memory: 45316kb
input:
1050 114
output:
870 895 816 110 378 170 171 493 829 186 205 151 253 844 230 804 48 507 885 975 618 746 1032 1037 103 811 256 806 745 723 1007 818 205 750 560 133 873 591 765 538 957 458 168 252 827 839 555 490 971 773 79 204 29 994 435 7 472 854 802 330 645 1044 15 1012 196 1049 919 877 186 106 315 493 469 1040 553...
result:
ok correct
Test #22:
score: 0
Accepted
time: 52ms
memory: 112792kb
input:
1132 514
output:
736 543 684 316 914 622 575 263 379 1100 1129 645 975 420 262 570 408 857 1131 855 860 706 478 35 635 309 872 1046 733 679 697 230 67 140 350 295 1071 325 933 800 703 1132 8 964 465 629 597 936 529 829 627 38 945 886 663 913 892 844 1032 570 599 66 513 88 62 1101 189 625 708 2 441 7 577 490 779 144 ...
result:
ok correct
Test #23:
score: 0
Accepted
time: 67ms
memory: 112976kb
input:
1130 514
output:
361 1113 832 178 43 212 1129 755 691 1082 369 454 531 1055 647 34 310 646 1056 266 313 466 550 1071 261 388 271 82 527 730 1033 149 441 105 758 361 390 152 36 739 570 293 463 824 187 636 233 702 859 692 28 326 670 165 762 1035 673 304 597 263 1107 1125 610 227 517 356 186 89 509 166 957 406 963 836 ...
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: 95ms
memory: 124660kb
input:
1151 564
output:
1068 1032 36 40 302 791 886 57 563 466 121 189 552 588 557 705 139 27 906 245 1103 756 690 720 862 1115 342 893 25 1122 360 268 1147 877 250 222 1084 890 905 431 771 694 247 1132 946 28 785 1132 768 713 523 117 370 731 1006 825 400 736 428 105 49 1067 361 973 729 426 642 928 452 926 911 28 1137 602 ...
result:
ok correct
Test #25:
score: 0
Accepted
time: 75ms
memory: 105392kb
input:
1042 511
output:
620 508 946 594 125 265 918 480 758 646 534 816 332 49 179 489 752 958 194 918 459 187 610 812 793 121 292 119 770 851 746 358 859 54 547 500 570 424 767 788 918 163 864 529 637 831 957 763 904 171 94 323 481 698 364 626 598 222 703 670 671 145 434 733 870 641 154 20 701 279 370 699 760 130 19 634 5...
result:
ok correct
Test #26:
score: 0
Accepted
time: 96ms
memory: 125876kb
input:
1170 575
output:
422 520 1118 954 907 1153 862 198 684 472 942 442 192 1069 295 843 50 406 696 300 451 447 880 478 137 277 120 395 648 631 256 216 107 966 893 344 1116 484 703 142 1018 1119 388 849 349 751 459 915 512 963 814 937 965 28 1156 1120 238 518 171 1140 827 21 756 977 742 857 154 222 397 391 716 1103 320 1...
result:
ok correct
Test #27:
score: 0
Accepted
time: 107ms
memory: 141852kb
input:
1249 615
output:
179 802 212 846 44 159 476 168 113 880 377 203 974 1050 899 1046 412 443 491 859 393 154 578 883 78 1013 132 963 1048 700 164 286 523 951 1211 208 417 408 443 369 117 1105 22 174 202 131 917 55 164 959 284 525 1221 809 1138 957 822 400 831 113 629 353 1013 1097 1009 309 827 840 1139 645 287 813 605 ...
result:
ok correct
Test #28:
score: 0
Accepted
time: 27ms
memory: 67260kb
input:
746 364
output:
484 296 300 646 614 451 121 335 232 293 580 328 471 226 573 368 734 420 464 329 618 277 45 306 437 540 378 375 468 477 362 734 652 175 474 643 364 563 230 441 359 164 407 653 503 20 108 526 95 435 450 402 501 38 99 517 103 26 72 691 319 221 386 399 284 80 299 413 376 691 415 81 270 241 430 673 214 6...
result:
ok correct
Test #29:
score: 0
Accepted
time: 93ms
memory: 122160kb
input:
1146 565
output:
872 210 1034 818 318 735 505 557 246 1095 80 674 567 1138 989 646 952 30 366 461 226 501 445 1138 3 54 96 903 544 597 798 992 526 983 760 553 1096 913 732 515 249 694 239 995 5 724 944 440 1083 103 510 206 771 694 233 499 995 672 56 603 579 1049 936 223 272 72 367 373 1084 727 261 857 1050 1055 556 ...
result:
ok correct
Test #30:
score: 0
Accepted
time: 23ms
memory: 45656kb
input:
554 265
output:
155 413 236 415 13 417 249 423 169 204 431 493 274 525 388 33 164 220 110 247 382 230 167 341 496 198 59 333 294 467 102 150 336 105 509 153 162 3 30 457 2 362 519 30 317 415 311 239 408 423 32 445 479 71 62 531 508 139 52 357 146 180 532 96 526 200 211 554 121 80 441 110 150 434 84 137 142 417 490 ...
result:
ok correct
Test #31:
score: 0
Accepted
time: 76ms
memory: 108056kb
input:
1061 519
output:
771 746 652 965 369 36 383 349 1044 470 484 128 64 213 287 1042 896 211 942 251 490 26 258 179 649 209 510 558 519 788 404 141 919 117 726 573 92 772 613 923 749 450 631 641 428 42 751 450 73 368 459 446 783 223 1001 607 514 457 813 416 849 124 926 219 165 778 226 225 707 55 1018 163 1024 686 494 95...
result:
ok correct
Test #32:
score: 0
Accepted
time: 6ms
memory: 25376kb
input:
173 78
output:
89 7 120 29 88 71 62 125 19 64 162 94 11 168 63 17 153 154 59 35 136 43 144 166 129 110 79 46 106 165 27 65 93 61 108 25 95 141 30 131 107 48 15 158 6 80 124 89 139 160 10 60 39 30 106 142 55 21 155 73 83 117 51 1 103 150 56 156 27 40 165 92 84 150 172 3 146 65 126 85 139 153 49 119 66 149 48 144 14...
result:
ok correct
Test #33:
score: 0
Accepted
time: 52ms
memory: 83204kb
input:
884 430
output:
375 3 427 292 26 485 386 502 462 827 446 168 658 667 394 58 279 16 643 608 773 272 875 36 200 312 683 269 466 525 28 365 41 321 153 734 395 494 451 464 186 233 154 240 750 654 73 472 522 826 801 348 300 547 745 160 782 108 453 729 804 421 870 570 325 269 704 164 589 533 198 228 138 17 202 599 409 24...
result:
ok correct
Test #34:
score: 0
Accepted
time: 78ms
memory: 113048kb
input:
1089 537
output:
268 176 103 141 480 223 913 604 177 833 832 954 470 850 356 972 911 720 173 622 257 332 85 933 608 939 169 69 165 45 189 890 704 357 549 332 112 734 990 79 289 594 113 380 417 587 580 148 186 657 151 574 536 763 102 973 1061 452 937 405 161 337 951 367 126 536 346 266 337 67 120 336 548 959 152 533 ...
result:
ok correct
Test #35:
score: 0
Accepted
time: 11ms
memory: 36808kb
input:
433 207
output:
343 129 360 198 35 42 342 410 174 402 279 127 181 153 115 264 358 344 205 34 405 170 143 78 18 379 357 190 383 98 411 197 311 415 119 16 84 332 122 386 247 428 300 319 142 80 113 273 280 70 261 366 365 40 336 423 366 168 297 197 53 161 118 419 260 145 37 164 196 375 6 364 32 29 314 95 53 266 308 27 ...
result:
ok correct