QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#347550 | #7526. Credit Cards | ucup-team1209 | AC ✓ | 33ms | 7464kb | C++20 | 1.0kb | 2024-03-09 14:14:09 | 2024-03-09 14:14:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define drep(i,y,x) for (int i=(y);i>=(x);i--)
#define pii pair<int,int>
#define fir first
#define sec second
#define MP make_pair
#define templ template<typename T>
templ bool chkmin(T &x,T y){return x>y?x=y,1:0;}
templ bool chkmax(T &x,T y){return x<y?x=y,1:0;}
void file() {
#ifdef zqj
freopen("a.in","r",stdin);
#endif
}
typedef long long ll;
int n;
int vis[1010000];
int main() {
file();
ios::sync_with_stdio(false),cin.tie(0);
cin>>n;
while (n%3!=1) --n;
int r=(n-1)/3+1;
cout<<n/3<<'\n';
while (r!=1) {
int len=r/2,t=0;
drep(i,r,r-len+1) {
int x=i,y=n-len-t,z=n-t;
assert(z<x+y&&1ll*z*z>1ll*x*x+1ll*y*y);
assert(!vis[x]&&!vis[y]&&!vis[z]);
vis[x]=vis[y]=vis[z]=1;
cout<<i<<' '<<n-len-t<<' '<<n-t<<'\n',++t;
}
r-=len;
n-=len*2;
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3676kb
input:
3
output:
0
result:
ok OK 0 triangles!
Test #2:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
4
output:
1 2 3 4
result:
ok OK 1 triangles!
Test #3:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
9
output:
2 3 6 7 2 4 5
result:
ok OK 2 triangles!
Test #4:
score: 0
Accepted
time: 33ms
memory: 7464kb
input:
1000000
output:
333333 333334 833333 1000000 333333 833332 999999 333332 833331 999998 333331 833330 999997 333330 833329 999996 333329 833328 999995 333328 833327 999994 333327 833326 999993 333326 833325 999992 333325 833324 999991 333324 833323 999990 333323 833322 999989 333322 833321 999988 333321 833320 99998...
result:
ok OK 333333 triangles!
Test #5:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
1
output:
0
result:
ok OK 0 triangles!
Test #6:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
2
output:
0
result:
ok OK 0 triangles!
Test #7:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
5
output:
1 2 3 4
result:
ok OK 1 triangles!
Test #8:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
6
output:
1 2 3 4
result:
ok OK 1 triangles!
Test #9:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
7
output:
2 3 6 7 2 4 5
result:
ok OK 2 triangles!
Test #10:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
8
output:
2 3 6 7 2 4 5
result:
ok OK 2 triangles!
Test #11:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
10
output:
3 4 8 10 3 7 9 2 5 6
result:
ok OK 3 triangles!
Test #12:
score: 0
Accepted
time: 22ms
memory: 6040kb
input:
621316
output:
207105 207106 517763 621316 207105 517762 621315 207104 517761 621314 207103 517760 621313 207102 517759 621312 207101 517758 621311 207100 517757 621310 207099 517756 621309 207098 517755 621308 207097 517754 621307 207096 517753 621306 207095 517752 621305 207094 517751 621304 207093 517750 621303...
result:
ok OK 207105 triangles!
Test #13:
score: 0
Accepted
time: 30ms
memory: 6464kb
input:
713171
output:
237723 237724 594308 713170 237723 594307 713169 237722 594306 713168 237721 594305 713167 237720 594304 713166 237719 594303 713165 237718 594302 713164 237717 594301 713163 237716 594300 713162 237715 594299 713161 237714 594298 713160 237713 594297 713159 237712 594296 713158 237711 594295 713157...
result:
ok OK 237723 triangles!
Test #14:
score: 0
Accepted
time: 33ms
memory: 6932kb
input:
825609
output:
275202 275203 688006 825607 275202 688005 825606 275201 688004 825605 275200 688003 825604 275199 688002 825603 275198 688001 825602 275197 688000 825601 275196 687999 825600 275195 687998 825599 275194 687997 825598 275193 687996 825597 275192 687995 825596 275191 687994 825595 275190 687993 825594...
result:
ok OK 275202 triangles!
Test #15:
score: 0
Accepted
time: 20ms
memory: 6628kb
input:
782282
output:
260760 260761 651901 782281 260760 651900 782280 260759 651899 782279 260758 651898 782278 260757 651897 782277 260756 651896 782276 260755 651895 782275 260754 651894 782274 260753 651893 782273 260752 651892 782272 260751 651891 782271 260750 651890 782270 260749 651889 782269 260748 651888 782268...
result:
ok OK 260760 triangles!
Test #16:
score: 0
Accepted
time: 6ms
memory: 4212kb
input:
148128
output:
49375 49376 123438 148126 49375 123437 148125 49374 123436 148124 49373 123435 148123 49372 123434 148122 49371 123433 148121 49370 123432 148120 49369 123431 148119 49368 123430 148118 49367 123429 148117 49366 123428 148116 49365 123427 148115 49364 123426 148114 49363 123425 148113 49362 123424 1...
result:
ok OK 49375 triangles!
Test #17:
score: 0
Accepted
time: 28ms
memory: 6352kb
input:
681282
output:
227093 227094 567733 681280 227093 567732 681279 227092 567731 681278 227091 567730 681277 227090 567729 681276 227089 567728 681275 227088 567727 681274 227087 567726 681273 227086 567725 681272 227085 567724 681271 227084 567723 681270 227083 567722 681269 227082 567721 681268 227081 567720 681267...
result:
ok OK 227093 triangles!
Test #18:
score: 0
Accepted
time: 33ms
memory: 6736kb
input:
798547
output:
266182 266183 665456 798547 266182 665455 798546 266181 665454 798545 266180 665453 798544 266179 665452 798543 266178 665451 798542 266177 665450 798541 266176 665449 798540 266175 665448 798539 266174 665447 798538 266173 665446 798537 266172 665445 798536 266171 665444 798535 266170 665443 798534...
result:
ok OK 266182 triangles!
Test #19:
score: 0
Accepted
time: 11ms
memory: 5020kb
input:
349290
output:
116429 116430 291073 349288 116429 291072 349287 116428 291071 349286 116427 291070 349285 116426 291069 349284 116425 291068 349283 116424 291067 349282 116423 291066 349281 116422 291065 349280 116421 291064 349279 116420 291063 349278 116419 291062 349277 116418 291061 349276 116417 291060 349275...
result:
ok OK 116429 triangles!
Test #20:
score: 0
Accepted
time: 13ms
memory: 4868kb
input:
317275
output:
105758 105759 264396 317275 105758 264395 317274 105757 264394 317273 105756 264393 317272 105755 264392 317271 105754 264391 317270 105753 264390 317269 105752 264389 317268 105751 264388 317267 105750 264387 317266 105749 264386 317265 105748 264385 317264 105747 264384 317263 105746 264383 317262...
result:
ok OK 105758 triangles!
Test #21:
score: 0
Accepted
time: 4ms
memory: 4016kb
input:
100000
output:
33333 33334 83333 100000 33333 83332 99999 33332 83331 99998 33331 83330 99997 33330 83329 99996 33329 83328 99995 33328 83327 99994 33327 83326 99993 33326 83325 99992 33325 83324 99991 33324 83323 99990 33323 83322 99989 33322 83321 99988 33321 83320 99987 33320 83319 99986 33319 83318 99985 33318...
result:
ok OK 33333 triangles!
Test #22:
score: 0
Accepted
time: 4ms
memory: 3896kb
input:
83568
output:
27855 27856 69638 83566 27855 69637 83565 27854 69636 83564 27853 69635 83563 27852 69634 83562 27851 69633 83561 27850 69632 83560 27849 69631 83559 27848 69630 83558 27847 69629 83557 27846 69628 83556 27845 69627 83555 27844 69626 83554 27843 69625 83553 27842 69624 83552 27841 69623 83551 27840 ...
result:
ok OK 27855 triangles!
Test #23:
score: 0
Accepted
time: 2ms
memory: 3708kb
input:
41476
output:
13825 13826 34563 41476 13825 34562 41475 13824 34561 41474 13823 34560 41473 13822 34559 41472 13821 34558 41471 13820 34557 41470 13819 34556 41469 13818 34555 41468 13817 34554 41467 13816 34553 41466 13815 34552 41465 13814 34551 41464 13813 34550 41463 13812 34549 41462 13811 34548 41461 13810 ...
result:
ok OK 13825 triangles!
Test #24:
score: 0
Accepted
time: 3ms
memory: 3880kb
input:
61028
output:
20342 20343 50856 61027 20342 50855 61026 20341 50854 61025 20340 50853 61024 20339 50852 61023 20338 50851 61022 20337 50850 61021 20336 50849 61020 20335 50848 61019 20334 50847 61018 20333 50846 61017 20332 50845 61016 20331 50844 61015 20330 50843 61014 20329 50842 61013 20328 50841 61012 20327 ...
result:
ok OK 20342 triangles!
Test #25:
score: 0
Accepted
time: 2ms
memory: 3764kb
input:
34231
output:
11410 11411 28526 34231 11410 28525 34230 11409 28524 34229 11408 28523 34228 11407 28522 34227 11406 28521 34226 11405 28520 34225 11404 28519 34224 11403 28518 34223 11402 28517 34222 11401 28516 34221 11400 28515 34220 11399 28514 34219 11398 28513 34218 11397 28512 34217 11396 28511 34216 11395 ...
result:
ok OK 11410 triangles!
Test #26:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
10000
output:
3333 3334 8333 10000 3333 8332 9999 3332 8331 9998 3331 8330 9997 3330 8329 9996 3329 8328 9995 3328 8327 9994 3327 8326 9993 3326 8325 9992 3325 8324 9991 3324 8323 9990 3323 8322 9989 3322 8321 9988 3321 8320 9987 3320 8319 9986 3319 8318 9985 3318 8317 9984 3317 8316 9983 3316 8315 9982 3315 8314...
result:
ok OK 3333 triangles!
Test #27:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
8370
output:
2789 2790 6973 8368 2789 6972 8367 2788 6971 8366 2787 6970 8365 2786 6969 8364 2785 6968 8363 2784 6967 8362 2783 6966 8361 2782 6965 8360 2781 6964 8359 2780 6963 8358 2779 6962 8357 2778 6961 8356 2777 6960 8355 2776 6959 8354 2775 6958 8353 2774 6957 8352 2773 6956 8351 2772 6955 8350 2771 6954 ...
result:
ok OK 2789 triangles!
Test #28:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
5858
output:
1952 1953 4881 5857 1952 4880 5856 1951 4879 5855 1950 4878 5854 1949 4877 5853 1948 4876 5852 1947 4875 5851 1946 4874 5850 1945 4873 5849 1944 4872 5848 1943 4871 5847 1942 4870 5846 1941 4869 5845 1940 4868 5844 1939 4867 5843 1938 4866 5842 1937 4865 5841 1936 4864 5840 1935 4863 5839 1934 4862 ...
result:
ok OK 1952 triangles!
Test #29:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
688
output:
229 230 573 688 229 572 687 228 571 686 227 570 685 226 569 684 225 568 683 224 567 682 223 566 681 222 565 680 221 564 679 220 563 678 219 562 677 218 561 676 217 560 675 216 559 674 215 558 673 214 557 672 213 556 671 212 555 670 211 554 669 210 553 668 209 552 667 208 551 666 207 550 665 206 549 ...
result:
ok OK 229 triangles!
Test #30:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
6480
output:
2159 2160 5398 6478 2159 5397 6477 2158 5396 6476 2157 5395 6475 2156 5394 6474 2155 5393 6473 2154 5392 6472 2153 5391 6471 2152 5390 6470 2151 5389 6469 2150 5388 6468 2149 5387 6467 2148 5386 6466 2147 5385 6465 2146 5384 6464 2145 5383 6463 2144 5382 6462 2143 5381 6461 2142 5380 6460 2141 5379 ...
result:
ok OK 2159 triangles!
Test #31:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
1000
output:
333 334 833 1000 333 832 999 332 831 998 331 830 997 330 829 996 329 828 995 328 827 994 327 826 993 326 825 992 325 824 991 324 823 990 323 822 989 322 821 988 321 820 987 320 819 986 319 818 985 318 817 984 317 816 983 316 815 982 315 814 981 314 813 980 313 812 979 312 811 978 311 810 977 310 809...
result:
ok OK 333 triangles!
Test #32:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
491
output:
163 164 408 490 163 407 489 162 406 488 161 405 487 160 404 486 159 403 485 158 402 484 157 401 483 156 400 482 155 399 481 154 398 480 153 397 479 152 396 478 151 395 477 150 394 476 149 393 475 148 392 474 147 391 473 146 390 472 145 389 471 144 388 470 143 387 469 142 386 468 141 385 467 140 384 ...
result:
ok OK 163 triangles!
Test #33:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
667
output:
222 223 556 667 222 555 666 221 554 665 220 553 664 219 552 663 218 551 662 217 550 661 216 549 660 215 548 659 214 547 658 213 546 657 212 545 656 211 544 655 210 543 654 209 542 653 208 541 652 207 540 651 206 539 650 205 538 649 204 537 648 203 536 647 202 535 646 201 534 645 200 533 644 199 532 ...
result:
ok OK 222 triangles!
Test #34:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
63
output:
20 21 51 61 20 50 60 19 49 59 18 48 58 17 47 57 16 46 56 15 45 55 14 44 54 13 43 53 12 42 52 11 36 41 10 35 40 9 34 39 8 33 38 7 32 37 6 28 31 5 27 30 4 26 29 3 24 25 2 22 23
result:
ok OK 20 triangles!
Test #35:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
682
output:
227 228 568 682 227 567 681 226 566 680 225 565 679 224 564 678 223 563 677 222 562 676 221 561 675 220 560 674 219 559 673 218 558 672 217 557 671 216 556 670 215 555 669 214 554 668 213 553 667 212 552 666 211 551 665 210 550 664 209 549 663 208 548 662 207 547 661 206 546 660 205 545 659 204 544 ...
result:
ok OK 227 triangles!
Test #36:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
100
output:
33 34 83 100 33 82 99 32 81 98 31 80 97 30 79 96 29 78 95 28 77 94 27 76 93 26 75 92 25 74 91 24 73 90 23 72 89 22 71 88 21 70 87 20 69 86 19 68 85 18 67 84 17 58 66 16 57 65 15 56 64 14 55 63 13 54 62 12 53 61 11 52 60 10 51 59 9 46 50 8 45 49 7 44 48 6 43 47 5 40 42 4 39 41 3 37 38 2 35 36
result:
ok OK 33 triangles!
Test #37:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
38
output:
12 13 31 37 12 30 36 11 29 35 10 28 34 9 27 33 8 26 32 7 22 25 6 21 24 5 20 23 4 17 19 3 16 18 2 14 15
result:
ok OK 12 triangles!
Test #38:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
167
output:
55 56 138 166 55 137 165 54 136 164 53 135 163 52 134 162 51 133 161 50 132 160 49 131 159 48 130 158 47 129 157 46 128 156 45 127 155 44 126 154 43 125 153 42 124 152 41 123 151 40 122 150 39 121 149 38 120 148 37 119 147 36 118 146 35 117 145 34 116 144 33 115 143 32 114 142 31 113 141 30 112 140 ...
result:
ok OK 55 triangles!
Test #39:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
34
output:
11 12 28 34 11 27 33 10 26 32 9 25 31 8 24 30 7 23 29 6 19 22 5 18 21 4 17 20 3 15 16 2 13 14
result:
ok OK 11 triangles!