QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#866038#7526. Credit Cardsushg8877#AC ✓40ms3712kbC++20636b2025-01-22 11:03:022025-01-22 11:03:02

Judging History

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

  • [2025-01-22 11:03:02]
  • 评测
  • 测评结果:AC
  • 用时:40ms
  • 内存:3712kb
  • [2025-01-22 11:03:02]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define mid ((l+r)>>1)
#define lowbit(i) (i&(-i))
using namespace std;
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int n; cin>>n;
	n--;
	int p=n/3;
	cout<<p<<"\n";
	if(p&1){
		for(int i=p,j=0;i>=3;i-=2,j++){
			cout<<i<<" "<<p+j+2<<" "<<2*p-j<<"\n";
		}
		for(int i=p+1,j=0;i>=2;i-=2,j++){
			cout<<i<<" "<<2*p+j+1<<" "<<3*p-j+1<<"\n";
		}
	}
	else{
		for(int i=p,j=0;i>=2;i-=2,j++){
			cout<<i<<" "<<p+j+2<<" "<<2*p+1-j<<"\n";
		}
		for(int i=p+1,j=0;i>=3;i-=2,j++){
			cout<<i<<" "<<2*p+j+2<<" "<<3*p+1-j<<"\n";
		}
	}
	return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3584kb

input:

3

output:

0

result:

ok OK 0 triangles!

Test #2:

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

input:

4

output:

1
2 3 4

result:

ok OK 1 triangles!

Test #3:

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

input:

9

output:

2
2 4 5
3 6 7

result:

ok OK 2 triangles!

Test #4:

score: 0
Accepted
time: 40ms
memory: 3712kb

input:

1000000

output:

333333
333333 333335 666666
333331 333336 666665
333329 333337 666664
333327 333338 666663
333325 333339 666662
333323 333340 666661
333321 333341 666660
333319 333342 666659
333317 333343 666658
333315 333344 666657
333313 333345 666656
333311 333346 666655
333309 333347 666654
333307 333348 666653...

result:

ok OK 333333 triangles!

Test #5:

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

input:

1

output:

0

result:

ok OK 0 triangles!

Test #6:

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

input:

2

output:

0

result:

ok OK 0 triangles!

Test #7:

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

input:

5

output:

1
2 3 4

result:

ok OK 1 triangles!

Test #8:

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

input:

6

output:

1
2 3 4

result:

ok OK 1 triangles!

Test #9:

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

input:

7

output:

2
2 4 5
3 6 7

result:

ok OK 2 triangles!

Test #10:

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

input:

8

output:

2
2 4 5
3 6 7

result:

ok OK 2 triangles!

Test #11:

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

input:

10

output:

3
3 5 6
4 7 10
2 8 9

result:

ok OK 3 triangles!

Test #12:

score: 0
Accepted
time: 23ms
memory: 3712kb

input:

621316

output:

207105
207105 207107 414210
207103 207108 414209
207101 207109 414208
207099 207110 414207
207097 207111 414206
207095 207112 414205
207093 207113 414204
207091 207114 414203
207089 207115 414202
207087 207116 414201
207085 207117 414200
207083 207118 414199
207081 207119 414198
207079 207120 414197...

result:

ok OK 207105 triangles!

Test #13:

score: 0
Accepted
time: 30ms
memory: 3584kb

input:

713171

output:

237723
237723 237725 475446
237721 237726 475445
237719 237727 475444
237717 237728 475443
237715 237729 475442
237713 237730 475441
237711 237731 475440
237709 237732 475439
237707 237733 475438
237705 237734 475437
237703 237735 475436
237701 237736 475435
237699 237737 475434
237697 237738 475433...

result:

ok OK 237723 triangles!

Test #14:

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

input:

825609

output:

275202
275202 275204 550405
275200 275205 550404
275198 275206 550403
275196 275207 550402
275194 275208 550401
275192 275209 550400
275190 275210 550399
275188 275211 550398
275186 275212 550397
275184 275213 550396
275182 275214 550395
275180 275215 550394
275178 275216 550393
275176 275217 550392...

result:

ok OK 275202 triangles!

Test #15:

score: 0
Accepted
time: 30ms
memory: 3712kb

input:

782282

output:

260760
260760 260762 521521
260758 260763 521520
260756 260764 521519
260754 260765 521518
260752 260766 521517
260750 260767 521516
260748 260768 521515
260746 260769 521514
260744 260770 521513
260742 260771 521512
260740 260772 521511
260738 260773 521510
260736 260774 521509
260734 260775 521508...

result:

ok OK 260760 triangles!

Test #16:

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

input:

148128

output:

49375
49375 49377 98750
49373 49378 98749
49371 49379 98748
49369 49380 98747
49367 49381 98746
49365 49382 98745
49363 49383 98744
49361 49384 98743
49359 49385 98742
49357 49386 98741
49355 49387 98740
49353 49388 98739
49351 49389 98738
49349 49390 98737
49347 49391 98736
49345 49392 98735
49343 ...

result:

ok OK 49375 triangles!

Test #17:

score: 0
Accepted
time: 30ms
memory: 3712kb

input:

681282

output:

227093
227093 227095 454186
227091 227096 454185
227089 227097 454184
227087 227098 454183
227085 227099 454182
227083 227100 454181
227081 227101 454180
227079 227102 454179
227077 227103 454178
227075 227104 454177
227073 227105 454176
227071 227106 454175
227069 227107 454174
227067 227108 454173...

result:

ok OK 227093 triangles!

Test #18:

score: 0
Accepted
time: 30ms
memory: 3712kb

input:

798547

output:

266182
266182 266184 532365
266180 266185 532364
266178 266186 532363
266176 266187 532362
266174 266188 532361
266172 266189 532360
266170 266190 532359
266168 266191 532358
266166 266192 532357
266164 266193 532356
266162 266194 532355
266160 266195 532354
266158 266196 532353
266156 266197 532352...

result:

ok OK 266182 triangles!

Test #19:

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

input:

349290

output:

116429
116429 116431 232858
116427 116432 232857
116425 116433 232856
116423 116434 232855
116421 116435 232854
116419 116436 232853
116417 116437 232852
116415 116438 232851
116413 116439 232850
116411 116440 232849
116409 116441 232848
116407 116442 232847
116405 116443 232846
116403 116444 232845...

result:

ok OK 116429 triangles!

Test #20:

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

input:

317275

output:

105758
105758 105760 211517
105756 105761 211516
105754 105762 211515
105752 105763 211514
105750 105764 211513
105748 105765 211512
105746 105766 211511
105744 105767 211510
105742 105768 211509
105740 105769 211508
105738 105770 211507
105736 105771 211506
105734 105772 211505
105732 105773 211504...

result:

ok OK 105758 triangles!

Test #21:

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

input:

100000

output:

33333
33333 33335 66666
33331 33336 66665
33329 33337 66664
33327 33338 66663
33325 33339 66662
33323 33340 66661
33321 33341 66660
33319 33342 66659
33317 33343 66658
33315 33344 66657
33313 33345 66656
33311 33346 66655
33309 33347 66654
33307 33348 66653
33305 33349 66652
33303 33350 66651
33301 ...

result:

ok OK 33333 triangles!

Test #22:

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

input:

83568

output:

27855
27855 27857 55710
27853 27858 55709
27851 27859 55708
27849 27860 55707
27847 27861 55706
27845 27862 55705
27843 27863 55704
27841 27864 55703
27839 27865 55702
27837 27866 55701
27835 27867 55700
27833 27868 55699
27831 27869 55698
27829 27870 55697
27827 27871 55696
27825 27872 55695
27823 ...

result:

ok OK 27855 triangles!

Test #23:

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

input:

41476

output:

13825
13825 13827 27650
13823 13828 27649
13821 13829 27648
13819 13830 27647
13817 13831 27646
13815 13832 27645
13813 13833 27644
13811 13834 27643
13809 13835 27642
13807 13836 27641
13805 13837 27640
13803 13838 27639
13801 13839 27638
13799 13840 27637
13797 13841 27636
13795 13842 27635
13793 ...

result:

ok OK 13825 triangles!

Test #24:

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

input:

61028

output:

20342
20342 20344 40685
20340 20345 40684
20338 20346 40683
20336 20347 40682
20334 20348 40681
20332 20349 40680
20330 20350 40679
20328 20351 40678
20326 20352 40677
20324 20353 40676
20322 20354 40675
20320 20355 40674
20318 20356 40673
20316 20357 40672
20314 20358 40671
20312 20359 40670
20310 ...

result:

ok OK 20342 triangles!

Test #25:

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

input:

34231

output:

11410
11410 11412 22821
11408 11413 22820
11406 11414 22819
11404 11415 22818
11402 11416 22817
11400 11417 22816
11398 11418 22815
11396 11419 22814
11394 11420 22813
11392 11421 22812
11390 11422 22811
11388 11423 22810
11386 11424 22809
11384 11425 22808
11382 11426 22807
11380 11427 22806
11378 ...

result:

ok OK 11410 triangles!

Test #26:

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

input:

10000

output:

3333
3333 3335 6666
3331 3336 6665
3329 3337 6664
3327 3338 6663
3325 3339 6662
3323 3340 6661
3321 3341 6660
3319 3342 6659
3317 3343 6658
3315 3344 6657
3313 3345 6656
3311 3346 6655
3309 3347 6654
3307 3348 6653
3305 3349 6652
3303 3350 6651
3301 3351 6650
3299 3352 6649
3297 3353 6648
3295 3354 ...

result:

ok OK 3333 triangles!

Test #27:

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

input:

8370

output:

2789
2789 2791 5578
2787 2792 5577
2785 2793 5576
2783 2794 5575
2781 2795 5574
2779 2796 5573
2777 2797 5572
2775 2798 5571
2773 2799 5570
2771 2800 5569
2769 2801 5568
2767 2802 5567
2765 2803 5566
2763 2804 5565
2761 2805 5564
2759 2806 5563
2757 2807 5562
2755 2808 5561
2753 2809 5560
2751 2810 ...

result:

ok OK 2789 triangles!

Test #28:

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

input:

5858

output:

1952
1952 1954 3905
1950 1955 3904
1948 1956 3903
1946 1957 3902
1944 1958 3901
1942 1959 3900
1940 1960 3899
1938 1961 3898
1936 1962 3897
1934 1963 3896
1932 1964 3895
1930 1965 3894
1928 1966 3893
1926 1967 3892
1924 1968 3891
1922 1969 3890
1920 1970 3889
1918 1971 3888
1916 1972 3887
1914 1973 ...

result:

ok OK 1952 triangles!

Test #29:

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

input:

688

output:

229
229 231 458
227 232 457
225 233 456
223 234 455
221 235 454
219 236 453
217 237 452
215 238 451
213 239 450
211 240 449
209 241 448
207 242 447
205 243 446
203 244 445
201 245 444
199 246 443
197 247 442
195 248 441
193 249 440
191 250 439
189 251 438
187 252 437
185 253 436
183 254 435
181 255 ...

result:

ok OK 229 triangles!

Test #30:

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

input:

6480

output:

2159
2159 2161 4318
2157 2162 4317
2155 2163 4316
2153 2164 4315
2151 2165 4314
2149 2166 4313
2147 2167 4312
2145 2168 4311
2143 2169 4310
2141 2170 4309
2139 2171 4308
2137 2172 4307
2135 2173 4306
2133 2174 4305
2131 2175 4304
2129 2176 4303
2127 2177 4302
2125 2178 4301
2123 2179 4300
2121 2180 ...

result:

ok OK 2159 triangles!

Test #31:

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

input:

1000

output:

333
333 335 666
331 336 665
329 337 664
327 338 663
325 339 662
323 340 661
321 341 660
319 342 659
317 343 658
315 344 657
313 345 656
311 346 655
309 347 654
307 348 653
305 349 652
303 350 651
301 351 650
299 352 649
297 353 648
295 354 647
293 355 646
291 356 645
289 357 644
287 358 643
285 359 ...

result:

ok OK 333 triangles!

Test #32:

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

input:

491

output:

163
163 165 326
161 166 325
159 167 324
157 168 323
155 169 322
153 170 321
151 171 320
149 172 319
147 173 318
145 174 317
143 175 316
141 176 315
139 177 314
137 178 313
135 179 312
133 180 311
131 181 310
129 182 309
127 183 308
125 184 307
123 185 306
121 186 305
119 187 304
117 188 303
115 189 ...

result:

ok OK 163 triangles!

Test #33:

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

input:

667

output:

222
222 224 445
220 225 444
218 226 443
216 227 442
214 228 441
212 229 440
210 230 439
208 231 438
206 232 437
204 233 436
202 234 435
200 235 434
198 236 433
196 237 432
194 238 431
192 239 430
190 240 429
188 241 428
186 242 427
184 243 426
182 244 425
180 245 424
178 246 423
176 247 422
174 248 ...

result:

ok OK 222 triangles!

Test #34:

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

input:

63

output:

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

result:

ok OK 20 triangles!

Test #35:

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

input:

682

output:

227
227 229 454
225 230 453
223 231 452
221 232 451
219 233 450
217 234 449
215 235 448
213 236 447
211 237 446
209 238 445
207 239 444
205 240 443
203 241 442
201 242 441
199 243 440
197 244 439
195 245 438
193 246 437
191 247 436
189 248 435
187 249 434
185 250 433
183 251 432
181 252 431
179 253 ...

result:

ok OK 227 triangles!

Test #36:

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

input:

100

output:

33
33 35 66
31 36 65
29 37 64
27 38 63
25 39 62
23 40 61
21 41 60
19 42 59
17 43 58
15 44 57
13 45 56
11 46 55
9 47 54
7 48 53
5 49 52
3 50 51
34 67 100
32 68 99
30 69 98
28 70 97
26 71 96
24 72 95
22 73 94
20 74 93
18 75 92
16 76 91
14 77 90
12 78 89
10 79 88
8 80 87
6 81 86
4 82 85
2 83 84

result:

ok OK 33 triangles!

Test #37:

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

input:

38

output:

12
12 14 25
10 15 24
8 16 23
6 17 22
4 18 21
2 19 20
13 26 37
11 27 36
9 28 35
7 29 34
5 30 33
3 31 32

result:

ok OK 12 triangles!

Test #38:

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

input:

167

output:

55
55 57 110
53 58 109
51 59 108
49 60 107
47 61 106
45 62 105
43 63 104
41 64 103
39 65 102
37 66 101
35 67 100
33 68 99
31 69 98
29 70 97
27 71 96
25 72 95
23 73 94
21 74 93
19 75 92
17 76 91
15 77 90
13 78 89
11 79 88
9 80 87
7 81 86
5 82 85
3 83 84
56 111 166
54 112 165
52 113 164
50 114 163
48 ...

result:

ok OK 55 triangles!

Test #39:

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

input:

34

output:

11
11 13 22
9 14 21
7 15 20
5 16 19
3 17 18
12 23 34
10 24 33
8 25 32
6 26 31
4 27 30
2 28 29

result:

ok OK 11 triangles!