QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#650874#7526. Credit Cardsucup-team3519#AC ✓47ms25496kbC++171.0kb2024-10-18 16:55:262024-10-18 16:55:27

Judging History

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

  • [2024-10-18 16:55:27]
  • 评测
  • 测评结果:AC
  • 用时:47ms
  • 内存:25496kb
  • [2024-10-18 16:55:26]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
vector<vector<int>>ans;
using ll=long long;
void add(int x,int y,int z){
    ans.push_back({x,y,z});
    assert(x+y>z);
    assert((ll)x*x+(ll)y*y<(ll)z*z);
}
void op(){
    cout<<ans.size()<<'\n';
    for(int i=0;i<ans.size();i++){
        for(int j=0;j<3;j++){
            cout<<ans[i][j]<<' ';
        }
        cout<<'\n';
    }
}
void solve(){
    int n;
    cin>>n;
    n=(n-1)/3*3+1;
    int cnt=n/3;
    if(n<=3){
        cout<<0<<'\n';
        return;
    }
    if(cnt%2==0){
        for(int l=cnt+2,m=cnt,r=l+m-1;m>=2;l++,r--,m-=2){
            add(m,l,r);
        }
        for(int m=cnt+1,r=n,l=r-m+2;m>=3;l++,r--,m-=2){
            add(m,l,r);
        }
    }
    else if(cnt%2==1){
        for(int l=cnt+2,m=cnt+1,r=l+m-1;m>=2;l++,r--,m-=2){
            add(m,l,r);
        }
        for(int m=cnt,r=n,l=r-m+2;m>=3;l++,r--,m-=2){
            add(m,l,r);
        }
    }
     op();
    
}
int main() {
    solve();
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3

output:

0

result:

ok OK 0 triangles!

Test #2:

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

input:

4

output:

1
2 3 4 

result:

ok OK 1 triangles!

Test #3:

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

input:

9

output:

2
2 4 5 
3 6 7 

result:

ok OK 2 triangles!

Test #4:

score: 0
Accepted
time: 47ms
memory: 23864kb

input:

1000000

output:

333333
333334 333335 666668 
333332 333336 666667 
333330 333337 666666 
333328 333338 666665 
333326 333339 666664 
333324 333340 666663 
333322 333341 666662 
333320 333342 666661 
333318 333343 666660 
333316 333344 666659 
333314 333345 666658 
333312 333346 666657 
333310 333347 666656 
333308 ...

result:

ok OK 333333 triangles!

Test #5:

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

input:

1

output:

0

result:

ok OK 0 triangles!

Test #6:

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

input:

2

output:

0

result:

ok OK 0 triangles!

Test #7:

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

input:

5

output:

1
2 3 4 

result:

ok OK 1 triangles!

Test #8:

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

input:

6

output:

1
2 3 4 

result:

ok OK 1 triangles!

Test #9:

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

input:

7

output:

2
2 4 5 
3 6 7 

result:

ok OK 2 triangles!

Test #10:

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

input:

8

output:

2
2 4 5 
3 6 7 

result:

ok OK 2 triangles!

Test #11:

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

input:

10

output:

3
4 5 8 
2 6 7 
3 9 10 

result:

ok OK 3 triangles!

Test #12:

score: 0
Accepted
time: 27ms
memory: 15688kb

input:

621316

output:

207105
207106 207107 414212 
207104 207108 414211 
207102 207109 414210 
207100 207110 414209 
207098 207111 414208 
207096 207112 414207 
207094 207113 414206 
207092 207114 414205 
207090 207115 414204 
207088 207116 414203 
207086 207117 414202 
207084 207118 414201 
207082 207119 414200 
207080 ...

result:

ok OK 207105 triangles!

Test #13:

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

input:

713171

output:

237723
237724 237725 475448 
237722 237726 475447 
237720 237727 475446 
237718 237728 475445 
237716 237729 475444 
237714 237730 475443 
237712 237731 475442 
237710 237732 475441 
237708 237733 475440 
237706 237734 475439 
237704 237735 475438 
237702 237736 475437 
237700 237737 475436 
237698 ...

result:

ok OK 237723 triangles!

Test #14:

score: 0
Accepted
time: 47ms
memory: 25496kb

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 ...

result:

ok OK 275202 triangles!

Test #15:

score: 0
Accepted
time: 25ms
memory: 17304kb

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 ...

result:

ok OK 260760 triangles!

Test #16:

score: 0
Accepted
time: 4ms
memory: 5792kb

input:

148128

output:

49375
49376 49377 98752 
49374 49378 98751 
49372 49379 98750 
49370 49380 98749 
49368 49381 98748 
49366 49382 98747 
49364 49383 98746 
49362 49384 98745 
49360 49385 98744 
49358 49386 98743 
49356 49387 98742 
49354 49388 98741 
49352 49389 98740 
49350 49390 98739 
49348 49391 98738 
49346 493...

result:

ok OK 49375 triangles!

Test #17:

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

input:

681282

output:

227093
227094 227095 454188 
227092 227096 454187 
227090 227097 454186 
227088 227098 454185 
227086 227099 454184 
227084 227100 454183 
227082 227101 454182 
227080 227102 454181 
227078 227103 454180 
227076 227104 454179 
227074 227105 454178 
227072 227106 454177 
227070 227107 454176 
227068 ...

result:

ok OK 227093 triangles!

Test #18:

score: 0
Accepted
time: 46ms
memory: 24028kb

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 ...

result:

ok OK 266182 triangles!

Test #19:

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

input:

349290

output:

116429
116430 116431 232860 
116428 116432 232859 
116426 116433 232858 
116424 116434 232857 
116422 116435 232856 
116420 116436 232855 
116418 116437 232854 
116416 116438 232853 
116414 116439 232852 
116412 116440 232851 
116410 116441 232850 
116408 116442 232849 
116406 116443 232848 
116404 ...

result:

ok OK 116429 triangles!

Test #20:

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

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 ...

result:

ok OK 105758 triangles!

Test #21:

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

input:

100000

output:

33333
33334 33335 66668 
33332 33336 66667 
33330 33337 66666 
33328 33338 66665 
33326 33339 66664 
33324 33340 66663 
33322 33341 66662 
33320 33342 66661 
33318 33343 66660 
33316 33344 66659 
33314 33345 66658 
33312 33346 66657 
33310 33347 66656 
33308 33348 66655 
33306 33349 66654 
33304 333...

result:

ok OK 33333 triangles!

Test #22:

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

input:

83568

output:

27855
27856 27857 55712 
27854 27858 55711 
27852 27859 55710 
27850 27860 55709 
27848 27861 55708 
27846 27862 55707 
27844 27863 55706 
27842 27864 55705 
27840 27865 55704 
27838 27866 55703 
27836 27867 55702 
27834 27868 55701 
27832 27869 55700 
27830 27870 55699 
27828 27871 55698 
27826 278...

result:

ok OK 27855 triangles!

Test #23:

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

input:

41476

output:

13825
13826 13827 27652 
13824 13828 27651 
13822 13829 27650 
13820 13830 27649 
13818 13831 27648 
13816 13832 27647 
13814 13833 27646 
13812 13834 27645 
13810 13835 27644 
13808 13836 27643 
13806 13837 27642 
13804 13838 27641 
13802 13839 27640 
13800 13840 27639 
13798 13841 27638 
13796 138...

result:

ok OK 13825 triangles!

Test #24:

score: 0
Accepted
time: 4ms
memory: 4564kb

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 203...

result:

ok OK 20342 triangles!

Test #25:

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

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 114...

result:

ok OK 11410 triangles!

Test #26:

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

input:

10000

output:

3333
3334 3335 6668 
3332 3336 6667 
3330 3337 6666 
3328 3338 6665 
3326 3339 6664 
3324 3340 6663 
3322 3341 6662 
3320 3342 6661 
3318 3343 6660 
3316 3344 6659 
3314 3345 6658 
3312 3346 6657 
3310 3347 6656 
3308 3348 6655 
3306 3349 6654 
3304 3350 6653 
3302 3351 6652 
3300 3352 6651 
3298 33...

result:

ok OK 3333 triangles!

Test #27:

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

input:

8370

output:

2789
2790 2791 5580 
2788 2792 5579 
2786 2793 5578 
2784 2794 5577 
2782 2795 5576 
2780 2796 5575 
2778 2797 5574 
2776 2798 5573 
2774 2799 5572 
2772 2800 5571 
2770 2801 5570 
2768 2802 5569 
2766 2803 5568 
2764 2804 5567 
2762 2805 5566 
2760 2806 5565 
2758 2807 5564 
2756 2808 5563 
2754 28...

result:

ok OK 2789 triangles!

Test #28:

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

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 19...

result:

ok OK 1952 triangles!

Test #29:

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

input:

688

output:

229
230 231 460 
228 232 459 
226 233 458 
224 234 457 
222 235 456 
220 236 455 
218 237 454 
216 238 453 
214 239 452 
212 240 451 
210 241 450 
208 242 449 
206 243 448 
204 244 447 
202 245 446 
200 246 445 
198 247 444 
196 248 443 
194 249 442 
192 250 441 
190 251 440 
188 252 439 
186 253 43...

result:

ok OK 229 triangles!

Test #30:

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

input:

6480

output:

2159
2160 2161 4320 
2158 2162 4319 
2156 2163 4318 
2154 2164 4317 
2152 2165 4316 
2150 2166 4315 
2148 2167 4314 
2146 2168 4313 
2144 2169 4312 
2142 2170 4311 
2140 2171 4310 
2138 2172 4309 
2136 2173 4308 
2134 2174 4307 
2132 2175 4306 
2130 2176 4305 
2128 2177 4304 
2126 2178 4303 
2124 21...

result:

ok OK 2159 triangles!

Test #31:

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

input:

1000

output:

333
334 335 668 
332 336 667 
330 337 666 
328 338 665 
326 339 664 
324 340 663 
322 341 662 
320 342 661 
318 343 660 
316 344 659 
314 345 658 
312 346 657 
310 347 656 
308 348 655 
306 349 654 
304 350 653 
302 351 652 
300 352 651 
298 353 650 
296 354 649 
294 355 648 
292 356 647 
290 357 64...

result:

ok OK 333 triangles!

Test #32:

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

input:

491

output:

163
164 165 328 
162 166 327 
160 167 326 
158 168 325 
156 169 324 
154 170 323 
152 171 322 
150 172 321 
148 173 320 
146 174 319 
144 175 318 
142 176 317 
140 177 316 
138 178 315 
136 179 314 
134 180 313 
132 181 312 
130 182 311 
128 183 310 
126 184 309 
124 185 308 
122 186 307 
120 187 30...

result:

ok OK 163 triangles!

Test #33:

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

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 42...

result:

ok OK 222 triangles!

Test #34:

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

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: 3580kb

input:

682

output:

227
228 229 456 
226 230 455 
224 231 454 
222 232 453 
220 233 452 
218 234 451 
216 235 450 
214 236 449 
212 237 448 
210 238 447 
208 239 446 
206 240 445 
204 241 444 
202 242 443 
200 243 442 
198 244 441 
196 245 440 
194 246 439 
192 247 438 
190 248 437 
188 249 436 
186 250 435 
184 251 43...

result:

ok OK 227 triangles!

Test #36:

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

input:

100

output:

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

result:

ok OK 33 triangles!

Test #37:

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

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: 3580kb

input:

167

output:

55
56 57 112 
54 58 111 
52 59 110 
50 60 109 
48 61 108 
46 62 107 
44 63 106 
42 64 105 
40 65 104 
38 66 103 
36 67 102 
34 68 101 
32 69 100 
30 70 99 
28 71 98 
26 72 97 
24 73 96 
22 74 95 
20 75 94 
18 76 93 
16 77 92 
14 78 91 
12 79 90 
10 80 89 
8 81 88 
6 82 87 
4 83 86 
2 84 85 
55 113 1...

result:

ok OK 55 triangles!

Test #39:

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

input:

34

output:

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

result:

ok OK 11 triangles!