QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#338488#7225. The Kirakira CycleKevin5307AC ✓2992ms204724kbC++20576b2024-02-25 23:02:022024-02-25 23:02:02

Judging History

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

  • [2024-02-25 23:02:02]
  • 评测
  • 测评结果:AC
  • 用时:2992ms
  • 内存:204724kb
  • [2024-02-25 23:02:02]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int lim=n*(n-1)/2;
	vector<int> f(lim+1);
	for(int i=1;i<=n;i++)
		for(int j=i;j<=lim;j+=i)
			f[j]-=i;
	for(int i=1;i<=lim;i++)
		f[i]+=f[i-1]+n;
	int ans=0;
	vector<bool> vis(lim+1);
	for(int i=0;i<=lim;i++)
	{
		vector<int> vec;
		int p=i;
		while(!vis[p])
		{
			vec.push_back(p);
			vis[p]=1;
			p=f[p];
		}
		reverse(vec.begin(),vec.end());
		while(!vec.empty()&&vec.back()!=p)
			vec.pop_back();
		ans=max(ans,(int)vec.size());
	}
	cout<<ans<<endl;
	return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3560kb

input:

2

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

10

output:

4

result:

ok 1 number(s): "4"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

43

output:

7

result:

ok 1 number(s): "7"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

1

output:

1

result:

ok 1 number(s): "1"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

3

output:

1

result:

ok 1 number(s): "1"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

4

output:

3

result:

ok 1 number(s): "3"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

5

output:

2

result:

ok 1 number(s): "2"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

6

output:

2

result:

ok 1 number(s): "2"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

7

output:

1

result:

ok 1 number(s): "1"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

8

output:

3

result:

ok 1 number(s): "3"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

9

output:

2

result:

ok 1 number(s): "2"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

11

output:

7

result:

ok 1 number(s): "7"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

13

output:

6

result:

ok 1 number(s): "6"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

17

output:

4

result:

ok 1 number(s): "4"

Test #15:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

19

output:

5

result:

ok 1 number(s): "5"

Test #16:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

23

output:

3

result:

ok 1 number(s): "3"

Test #17:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

29

output:

2

result:

ok 1 number(s): "2"

Test #18:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

31

output:

13

result:

ok 1 number(s): "13"

Test #19:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

37

output:

5

result:

ok 1 number(s): "5"

Test #20:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

41

output:

21

result:

ok 1 number(s): "21"

Test #21:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

60

output:

8

result:

ok 1 number(s): "8"

Test #22:

score: 0
Accepted
time: 1ms
memory: 3848kb

input:

100

output:

11

result:

ok 1 number(s): "11"

Test #23:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

105

output:

41

result:

ok 1 number(s): "41"

Test #24:

score: 0
Accepted
time: 1ms
memory: 3696kb

input:

128

output:

31

result:

ok 1 number(s): "31"

Test #25:

score: 0
Accepted
time: 1ms
memory: 3908kb

input:

130

output:

25

result:

ok 1 number(s): "25"

Test #26:

score: 0
Accepted
time: 1ms
memory: 4000kb

input:

256

output:

52

result:

ok 1 number(s): "52"

Test #27:

score: 0
Accepted
time: 1ms
memory: 3864kb

input:

290

output:

15

result:

ok 1 number(s): "15"

Test #28:

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

input:

455

output:

104

result:

ok 1 number(s): "104"

Test #29:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

512

output:

45

result:

ok 1 number(s): "45"

Test #30:

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

input:

777

output:

35

result:

ok 1 number(s): "35"

Test #31:

score: 0
Accepted
time: 7ms
memory: 4320kb

input:

707

output:

175

result:

ok 1 number(s): "175"

Test #32:

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

input:

449

output:

13

result:

ok 1 number(s): "13"

Test #33:

score: 0
Accepted
time: 5ms
memory: 4076kb

input:

573

output:

168

result:

ok 1 number(s): "168"

Test #34:

score: 0
Accepted
time: 10ms
memory: 4720kb

input:

858

output:

49

result:

ok 1 number(s): "49"

Test #35:

score: 0
Accepted
time: 1ms
memory: 3668kb

input:

230

output:

58

result:

ok 1 number(s): "58"

Test #36:

score: 0
Accepted
time: 6ms
memory: 5108kb

input:

972

output:

117

result:

ok 1 number(s): "117"

Test #37:

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

input:

844

output:

47

result:

ok 1 number(s): "47"

Test #38:

score: 0
Accepted
time: 2ms
memory: 3644kb

input:

378

output:

37

result:

ok 1 number(s): "37"

Test #39:

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

input:

423

output:

49

result:

ok 1 number(s): "49"

Test #40:

score: 0
Accepted
time: 1ms
memory: 3952kb

input:

209

output:

20

result:

ok 1 number(s): "20"

Test #41:

score: 0
Accepted
time: 782ms
memory: 67440kb

input:

5645

output:

338

result:

ok 1 number(s): "338"

Test #42:

score: 0
Accepted
time: 62ms
memory: 11448kb

input:

2034

output:

249

result:

ok 1 number(s): "249"

Test #43:

score: 0
Accepted
time: 969ms
memory: 79728kb

input:

6163

output:

206

result:

ok 1 number(s): "206"

Test #44:

score: 0
Accepted
time: 1034ms
memory: 86360kb

input:

6422

output:

346

result:

ok 1 number(s): "346"

Test #45:

score: 0
Accepted
time: 37ms
memory: 8152kb

input:

1550

output:

40

result:

ok 1 number(s): "40"

Test #46:

score: 0
Accepted
time: 1224ms
memory: 100088kb

input:

6940

output:

674

result:

ok 1 number(s): "674"

Test #47:

score: 0
Accepted
time: 64ms
memory: 11840kb

input:

2068

output:

157

result:

ok 1 number(s): "157"

Test #48:

score: 0
Accepted
time: 932ms
memory: 80476kb

input:

6197

output:

594

result:

ok 1 number(s): "594"

Test #49:

score: 0
Accepted
time: 1035ms
memory: 87196kb

input:

6456

output:

913

result:

ok 1 number(s): "913"

Test #50:

score: 0
Accepted
time: 2155ms
memory: 158472kb

input:

8776

output:

423

result:

ok 1 number(s): "423"

Test #51:

score: 0
Accepted
time: 246ms
memory: 33932kb

input:

3904

output:

281

result:

ok 1 number(s): "281"

Test #52:

score: 0
Accepted
time: 296ms
memory: 38060kb

input:

4163

output:

230

result:

ok 1 number(s): "230"

Test #53:

score: 0
Accepted
time: 333ms
memory: 42632kb

input:

4422

output:

631

result:

ok 1 number(s): "631"

Test #54:

score: 0
Accepted
time: 416ms
memory: 47172kb

input:

4681

output:

95

result:

ok 1 number(s): "95"

Test #55:

score: 0
Accepted
time: 2179ms
memory: 159728kb

input:

8810

output:

835

result:

ok 1 number(s): "835"

Test #56:

score: 0
Accepted
time: 254ms
memory: 34444kb

input:

3938

output:

350

result:

ok 1 number(s): "350"

Test #57:

score: 0
Accepted
time: 2522ms
memory: 178520kb

input:

9328

output:

373

result:

ok 1 number(s): "373"

Test #58:

score: 0
Accepted
time: 374ms
memory: 43156kb

input:

4456

output:

932

result:

ok 1 number(s): "932"

Test #59:

score: 0
Accepted
time: 477ms
memory: 48012kb

input:

4715

output:

476

result:

ok 1 number(s): "476"

Test #60:

score: 0
Accepted
time: 1604ms
memory: 120652kb

input:

7633

output:

591

result:

ok 1 number(s): "591"

Test #61:

score: 0
Accepted
time: 120ms
memory: 18568kb

input:

2762

output:

263

result:

ok 1 number(s): "263"

Test #62:

score: 0
Accepted
time: 1811ms
memory: 137092kb

input:

8152

output:

465

result:

ok 1 number(s): "465"

Test #63:

score: 0
Accepted
time: 174ms
memory: 24940kb

input:

3280

output:

157

result:

ok 1 number(s): "157"

Test #64:

score: 0
Accepted
time: 205ms
memory: 28504kb

input:

3539

output:

79

result:

ok 1 number(s): "79"

Test #65:

score: 0
Accepted
time: 1605ms
memory: 121580kb

input:

7668

output:

905

result:

ok 1 number(s): "905"

Test #66:

score: 0
Accepted
time: 1679ms
memory: 129888kb

input:

7927

output:

357

result:

ok 1 number(s): "357"

Test #67:

score: 0
Accepted
time: 1836ms
memory: 138260kb

input:

8186

output:

543

result:

ok 1 number(s): "543"

Test #68:

score: 0
Accepted
time: 175ms
memory: 25136kb

input:

3314

output:

306

result:

ok 1 number(s): "306"

Test #69:

score: 0
Accepted
time: 209ms
memory: 28808kb

input:

3573

output:

69

result:

ok 1 number(s): "69"

Test #70:

score: 0
Accepted
time: 1226ms
memory: 98328kb

input:

6873

output:

667

result:

ok 1 number(s): "667"

Test #71:

score: 0
Accepted
time: 60ms
memory: 11176kb

input:

2001

output:

134

result:

ok 1 number(s): "134"

Test #72:

score: 0
Accepted
time: 1480ms
memory: 113192kb

input:

7391

output:

477

result:

ok 1 number(s): "477"

Test #73:

score: 0
Accepted
time: 101ms
memory: 15948kb

input:

2519

output:

267

result:

ok 1 number(s): "267"

Test #74:

score: 0
Accepted
time: 122ms
memory: 18756kb

input:

2778

output:

162

result:

ok 1 number(s): "162"

Test #75:

score: 0
Accepted
time: 145ms
memory: 21872kb

input:

3037

output:

282

result:

ok 1 number(s): "282"

Test #76:

score: 0
Accepted
time: 175ms
memory: 25176kb

input:

3296

output:

458

result:

ok 1 number(s): "458"

Test #77:

score: 0
Accepted
time: 1464ms
memory: 114324kb

input:

7426

output:

214

result:

ok 1 number(s): "214"

Test #78:

score: 0
Accepted
time: 105ms
memory: 16264kb

input:

2554

output:

102

result:

ok 1 number(s): "102"

Test #79:

score: 0
Accepted
time: 1773ms
memory: 130344kb

input:

7944

output:

283

result:

ok 1 number(s): "283"

Test #80:

score: 0
Accepted
time: 909ms
memory: 78364kb

input:

6113

output:

121

result:

ok 1 number(s): "121"

Test #81:

score: 0
Accepted
time: 2911ms
memory: 204652kb

input:

10000

output:

917

result:

ok 1 number(s): "917"

Test #82:

score: 0
Accepted
time: 2925ms
memory: 204724kb

input:

9999

output:

470

result:

ok 1 number(s): "470"

Test #83:

score: 0
Accepted
time: 2895ms
memory: 204300kb

input:

9998

output:

1552

result:

ok 1 number(s): "1552"

Test #84:

score: 0
Accepted
time: 2888ms
memory: 204336kb

input:

9997

output:

538

result:

ok 1 number(s): "538"

Test #85:

score: 0
Accepted
time: 2962ms
memory: 204260kb

input:

9996

output:

193

result:

ok 1 number(s): "193"

Test #86:

score: 0
Accepted
time: 2903ms
memory: 204372kb

input:

9995

output:

624

result:

ok 1 number(s): "624"

Test #87:

score: 0
Accepted
time: 2868ms
memory: 204284kb

input:

9994

output:

481

result:

ok 1 number(s): "481"

Test #88:

score: 0
Accepted
time: 2891ms
memory: 204292kb

input:

9993

output:

617

result:

ok 1 number(s): "617"

Test #89:

score: 0
Accepted
time: 2910ms
memory: 204284kb

input:

9992

output:

433

result:

ok 1 number(s): "433"

Test #90:

score: 0
Accepted
time: 2981ms
memory: 204332kb

input:

9991

output:

425

result:

ok 1 number(s): "425"

Test #91:

score: 0
Accepted
time: 2881ms
memory: 204176kb

input:

9990

output:

509

result:

ok 1 number(s): "509"

Test #92:

score: 0
Accepted
time: 2875ms
memory: 204236kb

input:

9989

output:

808

result:

ok 1 number(s): "808"

Test #93:

score: 0
Accepted
time: 2904ms
memory: 204188kb

input:

9988

output:

734

result:

ok 1 number(s): "734"

Test #94:

score: 0
Accepted
time: 2917ms
memory: 204132kb

input:

9987

output:

922

result:

ok 1 number(s): "922"

Test #95:

score: 0
Accepted
time: 2967ms
memory: 204104kb

input:

9986

output:

1252

result:

ok 1 number(s): "1252"

Test #96:

score: 0
Accepted
time: 2873ms
memory: 203776kb

input:

9985

output:

378

result:

ok 1 number(s): "378"

Test #97:

score: 0
Accepted
time: 2866ms
memory: 203868kb

input:

9984

output:

472

result:

ok 1 number(s): "472"

Test #98:

score: 0
Accepted
time: 2917ms
memory: 203776kb

input:

9983

output:

363

result:

ok 1 number(s): "363"

Test #99:

score: 0
Accepted
time: 2888ms
memory: 203972kb

input:

9982

output:

1121

result:

ok 1 number(s): "1121"

Test #100:

score: 0
Accepted
time: 2992ms
memory: 203928kb

input:

9981

output:

261

result:

ok 1 number(s): "261"

Test #101:

score: 0
Accepted
time: 2938ms
memory: 203872kb

input:

9980

output:

228

result:

ok 1 number(s): "228"

Test #102:

score: 0
Accepted
time: 51ms
memory: 9844kb

input:

1811

output:

2

result:

ok 1 number(s): "2"

Test #103:

score: 0
Accepted
time: 721ms
memory: 66380kb

input:

5598

output:

14

result:

ok 1 number(s): "14"

Test #104:

score: 0
Accepted
time: 98ms
memory: 15548kb

input:

2466

output:

33

result:

ok 1 number(s): "33"

Extra Test:

score: 0
Extra Test Passed