QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#265840 | #7868. 天空度假山庄 | Crysfly | 100 ✓ | 62ms | 13332kb | C++17 | 1.4kb | 2023-11-25 21:39:23 | 2023-11-25 21:39:23 |
Judging History
answer
// what is matter? never mind.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define ull unsigned long long
#define int long long
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 400005
#define inf 0x3f3f3f3f
int n,k;
vi res;
vi cons(int k){
if(k==1)return {1};
if(k==2)return {-1,2};
vi o;
int sum=0;
For(i,1,k){
sum+=i;
o.pb(i);
}
if(sum%2!=1){
o.back()+=1;
sum+=1;
}
int nd=(sum-1)/2;
Rep(i,(int)o.size()-1,0){
if(nd>=o[i])nd-=o[i],o[i]=-o[i];
}
if(nd!=0)puts("QAQ");
return o;
}
signed main()
{
n=read(),k=read();
vi tmp=cons(k);
// for(int x:tmp)cout<<x<<" ";cout<<"\n";
For(i,0,n-2){
int u=i;
for(int x:tmp){
u=u+x;
u=(u%n+n)%n;
res.pb(u);
}
// cerr<<res.back()<<"\n";
}
for(int x:res)cout<<x+1<<" ";cout<<"\n";
return 0;
}
/*
2
9
101011110
1 1 3 3 3 6 2 2
4
1011
1 1 3
*/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 1ms
memory: 3732kb
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: 1ms
memory: 3728kb
input:
5166 2
output:
5166 2 1 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 ...
result:
ok correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
7445 2
output:
7445 2 1 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 ...
result:
ok correct
Test #4:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
1295 2
output:
1295 2 1 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 ...
result:
ok correct
Subtask #2:
score: 20
Accepted
Test #5:
score: 20
Accepted
time: 38ms
memory: 11748kb
input:
86132 9
output:
2 4 7 11 6 12 19 11 2 3 5 8 12 7 13 20 12 3 4 6 9 13 8 14 21 13 4 5 7 10 14 9 15 22 14 5 6 8 11 15 10 16 23 15 6 7 9 12 16 11 17 24 16 7 8 10 13 17 12 18 25 17 8 9 11 14 18 13 19 26 18 9 10 12 15 19 14 20 27 19 10 11 13 16 20 15 21 28 20 11 12 14 17 21 16 22 29 21 12 13 15 18 22 17 23 30 22 13 14 16...
result:
ok correct
Test #6:
score: 0
Accepted
time: 48ms
memory: 12196kb
input:
73452 11
output:
2 73452 3 7 12 18 25 33 24 14 2 3 1 4 8 13 19 26 34 25 15 3 4 2 5 9 14 20 27 35 26 16 4 5 3 6 10 15 21 28 36 27 17 5 6 4 7 11 16 22 29 37 28 18 6 7 5 8 12 17 23 30 38 29 19 7 8 6 9 13 18 24 31 39 30 20 8 9 7 10 14 19 25 32 40 31 21 9 10 8 11 15 20 26 33 41 32 22 10 11 9 12 16 21 27 34 42 33 23 11 12...
result:
ok correct
Test #7:
score: 0
Accepted
time: 29ms
memory: 7784kb
input:
23283 20
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 78 93 77 60 42 23 2 3 5 8 12 17 23 30 38 47 57 68 80 93 79 94 78 61 43 24 3 4 6 9 13 18 24 31 39 48 58 69 81 94 80 95 79 62 44 25 4 5 7 10 14 19 25 32 40 49 59 70 82 95 81 96 80 63 45 26 5 6 8 11 15 20 26 33 41 50 60 71 83 96 82 97 81 64 46 27 6 7 9 12 16 21 27 34...
result:
ok correct
Test #8:
score: 0
Accepted
time: 31ms
memory: 12132kb
input:
36944 17
output:
36944 2 5 9 14 20 27 35 44 54 65 77 64 50 35 19 2 1 3 6 10 15 21 28 36 45 55 66 78 65 51 36 20 3 2 4 7 11 16 22 29 37 46 56 67 79 66 52 37 21 4 3 5 8 12 17 23 30 38 47 57 68 80 67 53 38 22 5 4 6 9 13 18 24 31 39 48 58 69 81 68 54 39 23 6 5 7 10 14 19 25 32 40 49 59 70 82 69 55 40 24 7 6 8 11 15 20 2...
result:
ok correct
Test #9:
score: 0
Accepted
time: 38ms
memory: 11684kb
input:
61927 10
output:
2 4 7 11 16 22 29 21 12 2 3 5 8 12 17 23 30 22 13 3 4 6 9 13 18 24 31 23 14 4 5 7 10 14 19 25 32 24 15 5 6 8 11 15 20 26 33 25 16 6 7 9 12 16 21 27 34 26 17 7 8 10 13 17 22 28 35 27 18 8 9 11 14 18 23 29 36 28 19 9 10 12 15 19 24 30 37 29 20 10 11 13 16 20 25 31 38 30 21 11 12 14 17 21 26 32 39 31 2...
result:
ok correct
Subtask #3:
score: 20
Accepted
Dependency #2:
100%
Accepted
Test #10:
score: 20
Accepted
time: 1ms
memory: 3796kb
input:
111 17
output:
111 2 5 9 14 20 27 35 44 54 65 77 64 50 35 19 2 1 3 6 10 15 21 28 36 45 55 66 78 65 51 36 20 3 2 4 7 11 16 22 29 37 46 56 67 79 66 52 37 21 4 3 5 8 12 17 23 30 38 47 57 68 80 67 53 38 22 5 4 6 9 13 18 24 31 39 48 58 69 81 68 54 39 23 6 5 7 10 14 19 25 32 40 49 59 70 82 69 55 40 24 7 6 8 11 15 20 26 ...
result:
ok correct
Test #11:
score: 0
Accepted
time: 3ms
memory: 3644kb
input:
462 86
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 171 192 214 237 261 286 312 339 367 396 426 457 27 60 94 129 165 202 240 279 319 360 402 445 27 72 118 165 213 262 312 363 415 6 60 115 171 228 286 345 405 4 404 341 277 212 146 79 11 404 334 263 191 118 44 431 355 278 200 121 41 422 340 25...
result:
ok correct
Test #12:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
262 43
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 210 233 257 20 46 73 101 130 160 191 159 126 92 57 21 246 208 169 129 88 46 2 3 5 8 12 17 23 30 38 47 57 68 80 93 107 122 138 155 173 192 212 233 211 234 258 21 47 74 102 131 161 192 160 127 93 58 22 247 209 170 130 89 47 3 4 6 9 13...
result:
ok correct
Test #13:
score: 0
Accepted
time: 6ms
memory: 4096kb
input:
672 125
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 32 70 109 149 190 232 275 319 364 410 457 505 554 604 655 35 88 142 197 253 310 368 427 487 548 610 1 65 130 196 129 197 266 336 407 479 552 626 29 105 182 260 339 419 500 ...
result:
ok correct
Test #14:
score: 0
Accepted
time: 6ms
memory: 4096kb
input:
747 127
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 406 437 469 502 536 571 607 644 682 721 14 55 97 140 184 229 275 322 370 419 469 520 572 625 679 734 43 100 158 217 277 338 400 463 527 592 658 725 46 115 185 256 328 401 475 550 626 703 34 113 193 27...
result:
ok correct
Test #15:
score: 0
Accepted
time: 2ms
memory: 3724kb
input:
404 72
output:
2 4 7 11 16 22 29 37 46 56 45 57 70 84 99 115 132 150 169 189 210 232 255 279 304 330 357 385 10 40 71 103 136 170 205 241 278 316 355 395 32 74 117 161 206 252 299 347 396 42 93 41 392 338 283 227 170 112 53 397 336 274 211 147 82 16 353 285 216 146 75 2 3 5 8 12 17 23 30 38 47 57 46 58 71 85 100 1...
result:
ok correct
Subtask #4:
score: 20
Accepted
Test #16:
score: 20
Accepted
time: 22ms
memory: 8844kb
input:
1777 229
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 561 597 634 672 711 751 792 834 877 921 966 1012 1059 1107 1156 1206 1257 1309 1362 1416 1471 1527 1584 1642 1701 1761 45 107 170 234 299 365 432 500 569 639 710 782 855 929 1004 1...
result:
ok correct
Test #17:
score: 0
Accepted
time: 13ms
memory: 5260kb
input:
1129 229
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 561 597 634 672 711 751 792 834 877 921 966 1012 1059 1107 27 77 128 180 233 287 342 398 455 513 572 632 693 755 818 882 947 1013 1080 19 88 158 229 301 374 448 523 599 676 754 833...
result:
ok correct
Test #18:
score: 0
Accepted
time: 62ms
memory: 12540kb
input:
4253 233
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 947 991 1036 1082 1129 1177 1226 1276 1327 1379 1432 1486 1541 1597 1654 1712 1771 1831 1892 1954 2017 1953 2018 2084 2151 2219 2288 2358 2429 2501 ...
result:
ok correct
Test #19:
score: 0
Accepted
time: 36ms
memory: 12188kb
input:
2311 233
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 947 991 1036 1082 1129 1177 1226 1276 1327 1379 1432 1486 1541 1597 1654 1712 1771 1831 1892 1954 2017 1953 2018 2084 2151 2219 2288 47 118 190 263 ...
result:
ok correct
Test #20:
score: 0
Accepted
time: 46ms
memory: 12808kb
input:
6712 114
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 861 905 950 996 1043 1091 1140 1190 1241 1293 1346 1400 1455 1511 1568 1626 1685 1745 1806 1868 1931 1995 2060 2126 2193 2261 2330 2400 2471 2543 26...
result:
ok correct
Test #21:
score: 0
Accepted
time: 4ms
memory: 4276kb
input:
1050 114
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 861 905 950 996 1043 41 90 140 191 243 296 350 405 461 518 576 635 695 756 818 881 945 1010 26 93 161 230 300 371 443 516 590 665 741 818 896 975 5 ...
result:
ok correct
Test #22:
score: 0
Accepted
time: 34ms
memory: 12512kb
input:
1132 514
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 947 991 1036 1082 1129 45 94 144 195 247 300 354 409 465 522 580 639 699 760 822 885 949 1014 1080 15 83 152 222 293 365 438 512 587 663 740 818 897...
result:
ok correct
Test #23:
score: 0
Accepted
time: 35ms
memory: 12744kb
input:
1130 514
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 947 991 1036 1082 1129 47 96 146 197 249 302 356 411 467 524 582 641 701 762 824 887 951 1016 1082 19 87 156 226 297 369 442 516 591 667 744 822 901...
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: 39ms
memory: 12820kb
input:
1151 564
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 947 991 1036 1082 1129 26 75 125 176 228 281 335 390 446 503 561 620 680 741 803 866 930 995 1061 1128 45 114 184 255 327 400 474 549 625 702 780 85...
result:
ok correct
Test #25:
score: 0
Accepted
time: 32ms
memory: 12364kb
input:
1042 511
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 947 991 1036 40 87 135 184 234 285 337 390 444 499 555 612 670 729 789 850 912 975 1039 62 128 195 263 332 402 473 545 618 692 767 843 920 998 35 11...
result:
ok correct
Test #26:
score: 0
Accepted
time: 41ms
memory: 12188kb
input:
1170 575
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 947 991 1036 1082 1129 7 56 106 157 209 262 316 371 427 484 542 601 661 722 784 847 911 976 1042 1109 7 76 146 217 289 362 436 511 587 664 742 821 9...
result:
ok correct
Test #27:
score: 0
Accepted
time: 50ms
memory: 12992kb
input:
1249 615
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 947 991 1036 1082 1129 1177 1226 27 78 130 183 237 292 348 405 463 522 582 643 705 768 832 897 963 1030 1098 1167 1237 59 131 204 278 353 429 506 58...
result:
ok correct
Test #28:
score: 0
Accepted
time: 14ms
memory: 8344kb
input:
746 364
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 35 75 116 158 201 245 290 336 383 431 480 530 581 633 686 740 49 105 162 220 279 339 400 462 525 589 654 720 41 109 178 248 319 391 464 538 613 689 20 98 177 257 33...
result:
ok correct
Test #29:
score: 0
Accepted
time: 43ms
memory: 13332kb
input:
1146 565
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 947 991 1036 1082 1129 31 80 130 181 233 286 340 395 451 508 566 625 685 746 808 871 935 1000 1066 1133 55 124 194 265 337 410 484 559 635 712 790 8...
result:
ok correct
Test #30:
score: 0
Accepted
time: 7ms
memory: 5096kb
input:
554 265
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 8 42 77 113 150 188 227 267 308 350 393 437 482 528 21 69 118 168 219 271 324 378 433 489 546 50 109 169 230 292 355 419 484 550 63 131 200 270 341 413 486 6 81 157 234 312 391 471 552 80 ...
result:
ok correct
Test #31:
score: 0
Accepted
time: 36ms
memory: 12780kb
input:
1061 519
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 947 991 1036 21 68 116 165 215 266 318 371 425 480 536 479 537 596 656 717 779 842 906 971 1037 43 111 180 250 321 393 466 540 615 691 768 846 925 1...
result:
ok correct
Test #32:
score: 0
Accepted
time: 0ms
memory: 3956kb
input:
173 78
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 18 38 59 81 104 128 153 6 33 61 90 120 151 10 43 77 112 148 12 50 89 129 170 39 82 126 171 44 91 139 15 65 116 168 48 102 47 103 46 161 102 42 154 92 29 138 73 7 113 45 149 79 8 109 36 135 60 157 80 2 3 5 8 12 17 23 30 38 47 57 68 80 93 107 122...
result:
ok correct
Test #33:
score: 0
Accepted
time: 20ms
memory: 8252kb
input:
884 430
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 325 353 382 412 443 475 508 542 577 613 650 688 727 767 808 850 9 53 98 144 191 239 288 338 389 441 494 548 603 659 716 774 833 9 70 132 195 259 324 390 457 525 594 664 735 807 880 70 145 221 298 376 455 535 616 ...
result:
ok correct
Test #34:
score: 0
Accepted
time: 24ms
memory: 12628kb
input:
1089 537
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 436 466 497 529 562 596 631 667 704 742 781 821 862 904 947 991 1036 1082 40 88 137 187 238 290 343 397 452 508 565 623 682 742 803 865 928 992 1057 34 101 169 238 308 379 451 524 598 673 749 826 904 983 ...
result:
ok correct
Test #35:
score: 0
Accepted
time: 6ms
memory: 4280kb
input:
433 207
output:
2 4 7 11 16 22 29 37 46 56 67 79 92 106 121 137 154 172 191 211 232 254 277 301 326 352 379 407 3 33 64 96 129 163 198 234 271 309 348 388 429 38 81 125 170 216 263 311 360 410 28 80 133 187 242 298 355 413 39 99 160 222 285 349 414 47 114 182 251 321 392 31 104 178 253 329 406 51 130 210 291 373 23...
result:
ok correct