QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#267746#7868. 天空度假山庄xyz123100 ✓61ms32532kbC++142.1kb2023-11-27 17:55:462023-11-27 17:55:47

Judging History

你现在查看的是最新测评结果

  • [2023-11-27 17:55:47]
  • 评测
  • 测评结果:100
  • 用时:61ms
  • 内存:32532kb
  • [2023-11-27 17:55:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
long long T,a,b,c,d[1000001],v[1001][1001],o,h[1000001],fa[1000001],q,w,e,an,cn,fac[1000001],inv[1000001],st[1000001],u[1000001],vi[1000001];
char s[1000001];
struct p{long long q,w;}l[1000001];
long long pow_(long long qq,long long ww){long long ee=1;while(ww){if(ww&1) ee*=qq,ee%=mod;qq*=qq,qq%=mod,ww>>=1;}return ee%mod;}
inline int read(){int x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}return x*f;}
void add(long long qq,long long ww){l[++o].q=ww,l[o].w=h[qq],h[qq]=o;}
long long gcd(long long qq,long long ww){return !ww?qq:gcd(ww,qq%ww);}
long long find(long long qq){return qq==fa[qq]?qq:fa[qq]=find(fa[qq]);}
void merge(long long qq,long long ww){long long f1=find(qq),f2=find(ww);if(f1==f2) return;fa[f1]=f2;}
long long C(long long qq,long long ww){return fac[qq]*inv[ww]%mod*inv[qq-ww]%mod;}
int main()
{
//	freopen("1.in","r",stdin);
	srand((unsigned)(time(0)^(*new int)));
	fac[0]=1;for(int i=1;i<=1000000;i++) fac[i]=fac[i-1]*i%mod;
	inv[1000000]=pow_(fac[1000000],mod-2);for(int i=999999;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
	scanf("%lld%lld",&a,&b);
	vi[0]=1;
	long long tt=0,gg=(b+1)/2;
//	st[++cn]=0;
	while(1)
	{
		long long hh=tt;
		vi[hh]=1;
//		cout<<hh<<" ";
		if(vi[(hh+gg)%a])
		{
			if(vi[(hh+gg+1)%a]) break;
			for(int j=b+1;j>=2;j--)
			{
				if((b+1-j)%2==0) hh+=j;
				else hh-=j;
				if(b%2==0&&j==2) hh++;
				hh=(hh%a+a)%a;
				st[++cn]=hh;
			}
		}
		else
		{
			for(int j=b;j>=1;j--)
			{
				if((b-j)%2==0) hh+=j;
				else hh-=j;
				hh=(hh%a+a)%a;
				st[++cn]=hh;
			}
		}
		tt=hh;
	}
//	for(int i=1;i<cn;i++) v[st[i]+1][st[i+1]+1]=v[st[i+1]+1][st[i]+1]++;
//	bool fll=0;
//	for(int i=1;i<=a;i++)
//	{
//		for(int j=i+1;j<=a;j++)
//		{
//			if(v[i][j]>1)
//			{
//				cout<<i<<" "<<j<<"\n";fll=1;break;
//			}
//		}
//		if(fll) break;
//	}
//	cout<<cn<<" "<<b*(a-1); 
//	return 0;
	for(int i=1;i<=cn;i++) printf("%lld ",st[i]+1);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 12ms
memory: 24332kb

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: 4ms
memory: 24044kb

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: 13ms
memory: 24108kb

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: 8ms
memory: 26376kb

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: 58ms
memory: 30440kb

input:

86132 9

output:

10 2 9 3 8 4 7 5 6 15 7 14 8 13 9 12 10 11 20 12 19 13 18 14 17 15 16 25 17 24 18 23 19 22 20 21 30 22 29 23 28 24 27 25 26 35 27 34 28 33 29 32 30 31 40 32 39 33 38 34 37 35 36 45 37 44 38 43 39 42 40 41 50 42 49 43 48 44 47 45 46 55 47 54 48 53 49 52 50 51 60 52 59 53 58 54 57 55 56 65 57 64 58 63...

result:

ok correct

Test #6:

score: 0
Accepted
time: 48ms
memory: 30468kb

input:

73452 11

output:

12 2 11 3 10 4 9 5 8 6 7 18 8 17 9 16 10 15 11 14 12 13 24 14 23 15 22 16 21 17 20 18 19 30 20 29 21 28 22 27 23 26 24 25 36 26 35 27 34 28 33 29 32 30 31 42 32 41 33 40 34 39 35 38 36 37 48 38 47 39 46 40 45 41 44 42 43 54 44 53 45 52 46 51 47 50 48 49 60 50 59 51 58 52 57 53 56 54 55 66 56 65 57 6...

result:

ok correct

Test #7:

score: 0
Accepted
time: 32ms
memory: 30280kb

input:

23283 20

output:

21 2 20 3 19 4 18 5 17 6 16 7 15 8 14 9 13 10 12 11 31 12 30 13 29 14 28 15 27 16 26 17 25 18 24 19 23 20 22 21 41 22 40 23 39 24 38 25 37 26 36 27 35 28 34 29 33 30 32 31 51 32 50 33 49 34 48 35 47 36 46 37 45 38 44 39 43 40 42 41 61 42 60 43 59 44 58 45 57 46 56 47 55 48 54 49 53 50 52 51 71 52 70...

result:

ok correct

Test #8:

score: 0
Accepted
time: 45ms
memory: 28208kb

input:

36944 17

output:

18 2 17 3 16 4 15 5 14 6 13 7 12 8 11 9 10 27 11 26 12 25 13 24 14 23 15 22 16 21 17 20 18 19 36 20 35 21 34 22 33 23 32 24 31 25 30 26 29 27 28 45 29 44 30 43 31 42 32 41 33 40 34 39 35 38 36 37 54 38 53 39 52 40 51 41 50 42 49 43 48 44 47 45 46 63 47 62 48 61 49 60 50 59 51 58 52 57 53 56 54 55 72...

result:

ok correct

Test #9:

score: 0
Accepted
time: 48ms
memory: 28220kb

input:

61927 10

output:

11 2 10 3 9 4 8 5 7 6 16 7 15 8 14 9 13 10 12 11 21 12 20 13 19 14 18 15 17 16 26 17 25 18 24 19 23 20 22 21 31 22 30 23 29 24 28 25 27 26 36 27 35 28 34 29 33 30 32 31 41 32 40 33 39 34 38 35 37 36 46 37 45 38 44 39 43 40 42 41 51 42 50 43 49 44 48 45 47 46 56 47 55 48 54 49 53 50 52 51 61 52 60 53...

result:

ok correct

Subtask #3:

score: 20
Accepted

Dependency #2:

100%
Accepted

Test #10:

score: 20
Accepted
time: 8ms
memory: 26380kb

input:

111 17

output:

18 2 17 3 16 4 15 5 14 6 13 7 12 8 11 9 10 27 11 26 12 25 13 24 14 23 15 22 16 21 17 20 18 19 36 20 35 21 34 22 33 23 32 24 31 25 30 26 29 27 28 45 29 44 30 43 31 42 32 41 33 40 34 39 35 38 36 37 54 38 53 39 52 40 51 41 50 42 49 43 48 44 47 45 46 63 47 62 48 61 49 60 50 59 51 58 52 57 53 56 54 55 72...

result:

ok correct

Test #11:

score: 0
Accepted
time: 9ms
memory: 24104kb

input:

462 86

output:

87 2 86 3 85 4 84 5 83 6 82 7 81 8 80 9 79 10 78 11 77 12 76 13 75 14 74 15 73 16 72 17 71 18 70 19 69 20 68 21 67 22 66 23 65 24 64 25 63 26 62 27 61 28 60 29 59 30 58 31 57 32 56 33 55 34 54 35 53 36 52 37 51 38 50 39 49 40 48 41 47 42 46 43 45 44 130 45 129 46 128 47 127 48 126 49 125 50 124 51 1...

result:

ok correct

Test #12:

score: 0
Accepted
time: 8ms
memory: 26088kb

input:

262 43

output:

44 2 43 3 42 4 41 5 40 6 39 7 38 8 37 9 36 10 35 11 34 12 33 13 32 14 31 15 30 16 29 17 28 18 27 19 26 20 25 21 24 22 23 66 24 65 25 64 26 63 27 62 28 61 29 60 30 59 31 58 32 57 33 56 34 55 35 54 36 53 37 52 38 51 39 50 40 49 41 48 42 47 43 46 44 45 88 46 87 47 86 48 85 49 84 50 83 51 82 52 81 53 80...

result:

ok correct

Test #13:

score: 0
Accepted
time: 17ms
memory: 24108kb

input:

672 125

output:

126 2 125 3 124 4 123 5 122 6 121 7 120 8 119 9 118 10 117 11 116 12 115 13 114 14 113 15 112 16 111 17 110 18 109 19 108 20 107 21 106 22 105 23 104 24 103 25 102 26 101 27 100 28 99 29 98 30 97 31 96 32 95 33 94 34 93 35 92 36 91 37 90 38 89 39 88 40 87 41 86 42 85 43 84 44 83 45 82 46 81 47 80 48...

result:

ok correct

Test #14:

score: 0
Accepted
time: 11ms
memory: 26184kb

input:

747 127

output:

128 2 127 3 126 4 125 5 124 6 123 7 122 8 121 9 120 10 119 11 118 12 117 13 116 14 115 15 114 16 113 17 112 18 111 19 110 20 109 21 108 22 107 23 106 24 105 25 104 26 103 27 102 28 101 29 100 30 99 31 98 32 97 33 96 34 95 35 94 36 93 37 92 38 91 39 90 40 89 41 88 42 87 43 86 44 85 45 84 46 83 47 82 ...

result:

ok correct

Test #15:

score: 0
Accepted
time: 14ms
memory: 24348kb

input:

404 72

output:

73 2 72 3 71 4 70 5 69 6 68 7 67 8 66 9 65 10 64 11 63 12 62 13 61 14 60 15 59 16 58 17 57 18 56 19 55 20 54 21 53 22 52 23 51 24 50 25 49 26 48 27 47 28 46 29 45 30 44 31 43 32 42 33 41 34 40 35 39 36 38 37 109 38 108 39 107 40 106 41 105 42 104 43 103 44 102 45 101 46 100 47 99 48 98 49 97 50 96 5...

result:

ok correct

Subtask #4:

score: 20
Accepted

Test #16:

score: 20
Accepted
time: 32ms
memory: 30328kb

input:

1777 229

output:

230 2 229 3 228 4 227 5 226 6 225 7 224 8 223 9 222 10 221 11 220 12 219 13 218 14 217 15 216 16 215 17 214 18 213 19 212 20 211 21 210 22 209 23 208 24 207 25 206 26 205 27 204 28 203 29 202 30 201 31 200 32 199 33 198 34 197 35 196 36 195 37 194 38 193 39 192 40 191 41 190 42 189 43 188 44 187 45 ...

result:

ok correct

Test #17:

score: 0
Accepted
time: 19ms
memory: 28204kb

input:

1129 229

output:

230 2 229 3 228 4 227 5 226 6 225 7 224 8 223 9 222 10 221 11 220 12 219 13 218 14 217 15 216 16 215 17 214 18 213 19 212 20 211 21 210 22 209 23 208 24 207 25 206 26 205 27 204 28 203 29 202 30 201 31 200 32 199 33 198 34 197 35 196 36 195 37 194 38 193 39 192 40 191 41 190 42 189 43 188 44 187 45 ...

result:

ok correct

Test #18:

score: 0
Accepted
time: 61ms
memory: 32348kb

input:

4253 233

output:

234 2 233 3 232 4 231 5 230 6 229 7 228 8 227 9 226 10 225 11 224 12 223 13 222 14 221 15 220 16 219 17 218 18 217 19 216 20 215 21 214 22 213 23 212 24 211 25 210 26 209 27 208 28 207 29 206 30 205 31 204 32 203 33 202 34 201 35 200 36 199 37 198 38 197 39 196 40 195 41 194 42 193 43 192 44 191 45 ...

result:

ok correct

Test #19:

score: 0
Accepted
time: 35ms
memory: 28388kb

input:

2311 233

output:

234 2 233 3 232 4 231 5 230 6 229 7 228 8 227 9 226 10 225 11 224 12 223 13 222 14 221 15 220 16 219 17 218 18 217 19 216 20 215 21 214 22 213 23 212 24 211 25 210 26 209 27 208 28 207 29 206 30 205 31 204 32 203 33 202 34 201 35 200 36 199 37 198 38 197 39 196 40 195 41 194 42 193 43 192 44 191 45 ...

result:

ok correct

Test #20:

score: 0
Accepted
time: 53ms
memory: 32304kb

input:

6712 114

output:

115 2 114 3 113 4 112 5 111 6 110 7 109 8 108 9 107 10 106 11 105 12 104 13 103 14 102 15 101 16 100 17 99 18 98 19 97 20 96 21 95 22 94 23 93 24 92 25 91 26 90 27 89 28 88 29 87 30 86 31 85 32 84 33 83 34 82 35 81 36 80 37 79 38 78 39 77 40 76 41 75 42 74 43 73 44 72 45 71 46 70 47 69 48 68 49 67 5...

result:

ok correct

Test #21:

score: 0
Accepted
time: 8ms
memory: 28204kb

input:

1050 114

output:

115 2 114 3 113 4 112 5 111 6 110 7 109 8 108 9 107 10 106 11 105 12 104 13 103 14 102 15 101 16 100 17 99 18 98 19 97 20 96 21 95 22 94 23 93 24 92 25 91 26 90 27 89 28 88 29 87 30 86 31 85 32 84 33 83 34 82 35 81 36 80 37 79 38 78 39 77 40 76 41 75 42 74 43 73 44 72 45 71 46 70 47 69 48 68 49 67 5...

result:

ok correct

Test #22:

score: 0
Accepted
time: 45ms
memory: 28232kb

input:

1132 514

output:

515 2 514 3 513 4 512 5 511 6 510 7 509 8 508 9 507 10 506 11 505 12 504 13 503 14 502 15 501 16 500 17 499 18 498 19 497 20 496 21 495 22 494 23 493 24 492 25 491 26 490 27 489 28 488 29 487 30 486 31 485 32 484 33 483 34 482 35 481 36 480 37 479 38 478 39 477 40 476 41 475 42 474 43 473 44 472 45 ...

result:

ok correct

Test #23:

score: 0
Accepted
time: 41ms
memory: 30248kb

input:

1130 514

output:

515 2 514 3 513 4 512 5 511 6 510 7 509 8 508 9 507 10 506 11 505 12 504 13 503 14 502 15 501 16 500 17 499 18 498 19 497 20 496 21 495 22 494 23 493 24 492 25 491 26 490 27 489 28 488 29 487 30 486 31 485 32 484 33 483 34 482 35 481 36 480 37 479 38 478 39 477 40 476 41 475 42 474 43 473 44 472 45 ...

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: 49ms
memory: 32532kb

input:

1151 564

output:

565 2 564 3 563 4 562 5 561 6 560 7 559 8 558 9 557 10 556 11 555 12 554 13 553 14 552 15 551 16 550 17 549 18 548 19 547 20 546 21 545 22 544 23 543 24 542 25 541 26 540 27 539 28 538 29 537 30 536 31 535 32 534 33 533 34 532 35 531 36 530 37 529 38 528 39 527 40 526 41 525 42 524 43 523 44 522 45 ...

result:

ok correct

Test #25:

score: 0
Accepted
time: 31ms
memory: 28168kb

input:

1042 511

output:

512 2 511 3 510 4 509 5 508 6 507 7 506 8 505 9 504 10 503 11 502 12 501 13 500 14 499 15 498 16 497 17 496 18 495 19 494 20 493 21 492 22 491 23 490 24 489 25 488 26 487 27 486 28 485 29 484 30 483 31 482 32 481 33 480 34 479 35 478 36 477 37 476 38 475 39 474 40 473 41 472 42 471 43 470 44 469 45 ...

result:

ok correct

Test #26:

score: 0
Accepted
time: 42ms
memory: 30436kb

input:

1170 575

output:

576 2 575 3 574 4 573 5 572 6 571 7 570 8 569 9 568 10 567 11 566 12 565 13 564 14 563 15 562 16 561 17 560 18 559 19 558 20 557 21 556 22 555 23 554 24 553 25 552 26 551 27 550 28 549 29 548 30 547 31 546 32 545 33 544 34 543 35 542 36 541 37 540 38 539 39 538 40 537 41 536 42 535 43 534 44 533 45 ...

result:

ok correct

Test #27:

score: 0
Accepted
time: 48ms
memory: 32304kb

input:

1249 615

output:

616 2 615 3 614 4 613 5 612 6 611 7 610 8 609 9 608 10 607 11 606 12 605 13 604 14 603 15 602 16 601 17 600 18 599 19 598 20 597 21 596 22 595 23 594 24 593 25 592 26 591 27 590 28 589 29 588 30 587 31 586 32 585 33 584 34 583 35 582 36 581 37 580 38 579 39 578 40 577 41 576 42 575 43 574 44 573 45 ...

result:

ok correct

Test #28:

score: 0
Accepted
time: 24ms
memory: 28204kb

input:

746 364

output:

365 2 364 3 363 4 362 5 361 6 360 7 359 8 358 9 357 10 356 11 355 12 354 13 353 14 352 15 351 16 350 17 349 18 348 19 347 20 346 21 345 22 344 23 343 24 342 25 341 26 340 27 339 28 338 29 337 30 336 31 335 32 334 33 333 34 332 35 331 36 330 37 329 38 328 39 327 40 326 41 325 42 324 43 323 44 322 45 ...

result:

ok correct

Test #29:

score: 0
Accepted
time: 44ms
memory: 28200kb

input:

1146 565

output:

566 2 565 3 564 4 563 5 562 6 561 7 560 8 559 9 558 10 557 11 556 12 555 13 554 14 553 15 552 16 551 17 550 18 549 19 548 20 547 21 546 22 545 23 544 24 543 25 542 26 541 27 540 28 539 29 538 30 537 31 536 32 535 33 534 34 533 35 532 36 531 37 530 38 529 39 528 40 527 41 526 42 525 43 524 44 523 45 ...

result:

ok correct

Test #30:

score: 0
Accepted
time: 14ms
memory: 28428kb

input:

554 265

output:

266 2 265 3 264 4 263 5 262 6 261 7 260 8 259 9 258 10 257 11 256 12 255 13 254 14 253 15 252 16 251 17 250 18 249 19 248 20 247 21 246 22 245 23 244 24 243 25 242 26 241 27 240 28 239 29 238 30 237 31 236 32 235 33 234 34 233 35 232 36 231 37 230 38 229 39 228 40 227 41 226 42 225 43 224 44 223 45 ...

result:

ok correct

Test #31:

score: 0
Accepted
time: 39ms
memory: 28388kb

input:

1061 519

output:

520 2 519 3 518 4 517 5 516 6 515 7 514 8 513 9 512 10 511 11 510 12 509 13 508 14 507 15 506 16 505 17 504 18 503 19 502 20 501 21 500 22 499 23 498 24 497 25 496 26 495 27 494 28 493 29 492 30 491 31 490 32 489 33 488 34 487 35 486 36 485 37 484 38 483 39 482 40 481 41 480 42 479 43 478 44 477 45 ...

result:

ok correct

Test #32:

score: 0
Accepted
time: 3ms
memory: 26216kb

input:

173 78

output:

79 2 78 3 77 4 76 5 75 6 74 7 73 8 72 9 71 10 70 11 69 12 68 13 67 14 66 15 65 16 64 17 63 18 62 19 61 20 60 21 59 22 58 23 57 24 56 25 55 26 54 27 53 28 52 29 51 30 50 31 49 32 48 33 47 34 46 35 45 36 44 37 43 38 42 39 41 40 118 41 117 42 116 43 115 44 114 45 113 46 112 47 111 48 110 49 109 50 108 ...

result:

ok correct

Test #33:

score: 0
Accepted
time: 33ms
memory: 26152kb

input:

884 430

output:

431 2 430 3 429 4 428 5 427 6 426 7 425 8 424 9 423 10 422 11 421 12 420 13 419 14 418 15 417 16 416 17 415 18 414 19 413 20 412 21 411 22 410 23 409 24 408 25 407 26 406 27 405 28 404 29 403 30 402 31 401 32 400 33 399 34 398 35 397 36 396 37 395 38 394 39 393 40 392 41 391 42 390 43 389 44 388 45 ...

result:

ok correct

Test #34:

score: 0
Accepted
time: 44ms
memory: 28148kb

input:

1089 537

output:

538 2 537 3 536 4 535 5 534 6 533 7 532 8 531 9 530 10 529 11 528 12 527 13 526 14 525 15 524 16 523 17 522 18 521 19 520 20 519 21 518 22 517 23 516 24 515 25 514 26 513 27 512 28 511 29 510 30 509 31 508 32 507 33 506 34 505 35 504 36 503 37 502 38 501 39 500 40 499 41 498 42 497 43 496 44 495 45 ...

result:

ok correct

Test #35:

score: 0
Accepted
time: 8ms
memory: 24136kb

input:

433 207

output:

208 2 207 3 206 4 205 5 204 6 203 7 202 8 201 9 200 10 199 11 198 12 197 13 196 14 195 15 194 16 193 17 192 18 191 19 190 20 189 21 188 22 187 23 186 24 185 25 184 26 183 27 182 28 181 29 180 30 179 31 178 32 177 33 176 34 175 35 174 36 173 37 172 38 171 39 170 40 169 41 168 42 167 43 166 44 165 45 ...

result:

ok correct