QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#272585 | #7526. Credit Cards | vxv | AC ✓ | 35ms | 8824kb | C++20 | 667b | 2023-12-02 17:56:49 | 2023-12-02 17:56:50 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long int i64;
int n, k;
int ans[1001001][3];
int main() {
scanf("%d", &n);
k = (n-1)/3;
for(int a=2, b=k+2;a<=k+1;a++, b+=2) {
ans[a-1][0] = a;
ans[a-1][1] = b;
ans[a-1][2] = b+1;
}
for(int i=k;i>0;i--) {
int a = ans[i][0], b = ans[i][1], c = ans[i][2];
int det = 1;
while(b>0 && (i64)a*a+(i64)b*b>=(i64)c*c) { b--; det++; }
ans[i][1] = b;
for(int j=i-1;j>i-det;j--) {
ans[j][1] = ans[j+1][1]-1;
ans[j][2] = ans[j+1][2]-1;
}
}
printf("%d\n", k);
for(int i=1;i<=k;i++)
printf("%d %d %d\n", ans[i][0], ans[i][1], ans[i][2]);
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3580kb
input:
3
output:
0
result:
ok OK 0 triangles!
Test #2:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
4
output:
1 2 3 4
result:
ok OK 1 triangles!
Test #3:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
9
output:
2 2 4 5 3 6 7
result:
ok OK 2 triangles!
Test #4:
score: 0
Accepted
time: 28ms
memory: 8824kb
input:
1000000
output:
333333 2 333335 333336 3 333337 333338 4 333339 333340 5 333341 333342 6 333343 333344 7 333345 333346 8 333347 333348 9 333349 333350 10 333351 333352 11 333353 333354 12 333355 333356 13 333357 333358 14 333359 333360 15 333361 333362 16 333363 333364 17 333365 333366 18 333367 333368 19 333369 33...
result:
ok OK 333333 triangles!
Test #5:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
1
output:
0
result:
ok OK 0 triangles!
Test #6:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
2
output:
0
result:
ok OK 0 triangles!
Test #7:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
5
output:
1 2 3 4
result:
ok OK 1 triangles!
Test #8:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
6
output:
1 2 3 4
result:
ok OK 1 triangles!
Test #9:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
7
output:
2 2 4 5 3 6 7
result:
ok OK 2 triangles!
Test #10:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
8
output:
2 2 4 5 3 6 7
result:
ok OK 2 triangles!
Test #11:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
10
output:
3 2 5 6 3 7 8 4 9 10
result:
ok OK 3 triangles!
Test #12:
score: 0
Accepted
time: 27ms
memory: 8036kb
input:
621316
output:
207105 2 207107 207108 3 207109 207110 4 207111 207112 5 207113 207114 6 207115 207116 7 207117 207118 8 207119 207120 9 207121 207122 10 207123 207124 11 207125 207126 12 207127 207128 13 207129 207130 14 207131 207132 15 207133 207134 16 207135 207136 17 207137 207138 18 207139 207140 19 207141 20...
result:
ok OK 207105 triangles!
Test #13:
score: 0
Accepted
time: 20ms
memory: 6436kb
input:
713171
output:
237723 2 237725 237726 3 237727 237728 4 237729 237730 5 237731 237732 6 237733 237734 7 237735 237736 8 237737 237738 9 237739 237740 10 237741 237742 11 237743 237744 12 237745 237746 13 237747 237748 14 237749 237750 15 237751 237752 16 237753 237754 17 237755 237756 18 237757 237758 19 237759 23...
result:
ok OK 237723 triangles!
Test #14:
score: 0
Accepted
time: 35ms
memory: 7160kb
input:
825609
output:
275202 2 275204 275205 3 275206 275207 4 275208 275209 5 275210 275211 6 275212 275213 7 275214 275215 8 275216 275217 9 275218 275219 10 275220 275221 11 275222 275223 12 275224 275225 13 275226 275227 14 275228 275229 15 275230 275231 16 275232 275233 17 275234 275235 18 275236 275237 19 275238 27...
result:
ok OK 275202 triangles!
Test #15:
score: 0
Accepted
time: 21ms
memory: 7936kb
input:
782282
output:
260760 2 260762 260763 3 260764 260765 4 260766 260767 5 260768 260769 6 260770 260771 7 260772 260773 8 260774 260775 9 260776 260777 10 260778 260779 11 260780 260781 12 260782 260783 13 260784 260785 14 260786 260787 15 260788 260789 16 260790 260791 17 260792 260793 18 260794 260795 19 260796 26...
result:
ok OK 260760 triangles!
Test #16:
score: 0
Accepted
time: 3ms
memory: 4244kb
input:
148128
output:
49375 2 49377 49378 3 49379 49380 4 49381 49382 5 49383 49384 6 49385 49386 7 49387 49388 8 49389 49390 9 49391 49392 10 49393 49394 11 49395 49396 12 49397 49398 13 49399 49400 14 49401 49402 15 49403 49404 16 49405 49406 17 49407 49408 18 49409 49410 19 49411 49412 20 49413 49414 21 49415 49416 22...
result:
ok OK 49375 triangles!
Test #17:
score: 0
Accepted
time: 25ms
memory: 8224kb
input:
681282
output:
227093 2 227095 227096 3 227097 227098 4 227099 227100 5 227101 227102 6 227103 227104 7 227105 227106 8 227107 227108 9 227109 227110 10 227111 227112 11 227113 227114 12 227115 227116 13 227117 227118 14 227119 227120 15 227121 227122 16 227123 227124 17 227125 227126 18 227127 227128 19 227129 22...
result:
ok OK 227093 triangles!
Test #18:
score: 0
Accepted
time: 32ms
memory: 8444kb
input:
798547
output:
266182 2 266184 266185 3 266186 266187 4 266188 266189 5 266190 266191 6 266192 266193 7 266194 266195 8 266196 266197 9 266198 266199 10 266200 266201 11 266202 266203 12 266204 266205 13 266206 266207 14 266208 266209 15 266210 266211 16 266212 266213 17 266214 266215 18 266216 266217 19 266218 26...
result:
ok OK 266182 triangles!
Test #19:
score: 0
Accepted
time: 11ms
memory: 5008kb
input:
349290
output:
116429 2 116431 116432 3 116433 116434 4 116435 116436 5 116437 116438 6 116439 116440 7 116441 116442 8 116443 116444 9 116445 116446 10 116447 116448 11 116449 116450 12 116451 116452 13 116453 116454 14 116455 116456 15 116457 116458 16 116459 116460 17 116461 116462 18 116463 116464 19 116465 11...
result:
ok OK 116429 triangles!
Test #20:
score: 0
Accepted
time: 14ms
memory: 6152kb
input:
317275
output:
105758 2 105760 105761 3 105762 105763 4 105764 105765 5 105766 105767 6 105768 105769 7 105770 105771 8 105772 105773 9 105774 105775 10 105776 105777 11 105778 105779 12 105780 105781 13 105782 105783 14 105784 105785 15 105786 105787 16 105788 105789 17 105790 105791 18 105792 105793 19 105794 10...
result:
ok OK 105758 triangles!
Test #21:
score: 0
Accepted
time: 0ms
memory: 4212kb
input:
100000
output:
33333 2 33335 33336 3 33337 33338 4 33339 33340 5 33341 33342 6 33343 33344 7 33345 33346 8 33347 33348 9 33349 33350 10 33351 33352 11 33353 33354 12 33355 33356 13 33357 33358 14 33359 33360 15 33361 33362 16 33363 33364 17 33365 33366 18 33367 33368 19 33369 33370 20 33371 33372 21 33373 33374 22...
result:
ok OK 33333 triangles!
Test #22:
score: 0
Accepted
time: 4ms
memory: 3988kb
input:
83568
output:
27855 2 27857 27858 3 27859 27860 4 27861 27862 5 27863 27864 6 27865 27866 7 27867 27868 8 27869 27870 9 27871 27872 10 27873 27874 11 27875 27876 12 27877 27878 13 27879 27880 14 27881 27882 15 27883 27884 16 27885 27886 17 27887 27888 18 27889 27890 19 27891 27892 20 27893 27894 21 27895 27896 22...
result:
ok OK 27855 triangles!
Test #23:
score: 0
Accepted
time: 2ms
memory: 3744kb
input:
41476
output:
13825 2 13827 13828 3 13829 13830 4 13831 13832 5 13833 13834 6 13835 13836 7 13837 13838 8 13839 13840 9 13841 13842 10 13843 13844 11 13845 13846 12 13847 13848 13 13849 13850 14 13851 13852 15 13853 13854 16 13855 13856 17 13857 13858 18 13859 13860 19 13861 13862 20 13863 13864 21 13865 13866 22...
result:
ok OK 13825 triangles!
Test #24:
score: 0
Accepted
time: 3ms
memory: 3836kb
input:
61028
output:
20342 2 20344 20345 3 20346 20347 4 20348 20349 5 20350 20351 6 20352 20353 7 20354 20355 8 20356 20357 9 20358 20359 10 20360 20361 11 20362 20363 12 20364 20365 13 20366 20367 14 20368 20369 15 20370 20371 16 20372 20373 17 20374 20375 18 20376 20377 19 20378 20379 20 20380 20381 21 20382 20383 22...
result:
ok OK 20342 triangles!
Test #25:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
34231
output:
11410 2 11412 11413 3 11414 11415 4 11416 11417 5 11418 11419 6 11420 11421 7 11422 11423 8 11424 11425 9 11426 11427 10 11428 11429 11 11430 11431 12 11432 11433 13 11434 11435 14 11436 11437 15 11438 11439 16 11440 11441 17 11442 11443 18 11444 11445 19 11446 11447 20 11448 11449 21 11450 11451 22...
result:
ok OK 11410 triangles!
Test #26:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
10000
output:
3333 2 3335 3336 3 3337 3338 4 3339 3340 5 3341 3342 6 3343 3344 7 3345 3346 8 3347 3348 9 3349 3350 10 3351 3352 11 3353 3354 12 3355 3356 13 3357 3358 14 3359 3360 15 3361 3362 16 3363 3364 17 3365 3366 18 3367 3368 19 3369 3370 20 3371 3372 21 3373 3374 22 3375 3376 23 3377 3378 24 3379 3380 25 3...
result:
ok OK 3333 triangles!
Test #27:
score: 0
Accepted
time: 1ms
memory: 5720kb
input:
8370
output:
2789 2 2791 2792 3 2793 2794 4 2795 2796 5 2797 2798 6 2799 2800 7 2801 2802 8 2803 2804 9 2805 2806 10 2807 2808 11 2809 2810 12 2811 2812 13 2813 2814 14 2815 2816 15 2817 2818 16 2819 2820 17 2821 2822 18 2823 2824 19 2825 2826 20 2827 2828 21 2829 2830 22 2831 2832 23 2833 2834 24 2835 2836 25 2...
result:
ok OK 2789 triangles!
Test #28:
score: 0
Accepted
time: 1ms
memory: 3540kb
input:
5858
output:
1952 2 1954 1955 3 1956 1957 4 1958 1959 5 1960 1961 6 1962 1963 7 1964 1965 8 1966 1967 9 1968 1969 10 1970 1971 11 1972 1973 12 1974 1975 13 1976 1977 14 1978 1979 15 1980 1981 16 1982 1983 17 1984 1985 18 1986 1987 19 1988 1989 20 1990 1991 21 1992 1993 22 1994 1995 23 1996 1997 24 1998 1999 25 2...
result:
ok OK 1952 triangles!
Test #29:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
688
output:
229 2 231 232 3 233 234 4 235 236 5 237 238 6 239 240 7 241 242 8 243 244 9 245 246 10 247 248 11 249 250 12 251 252 13 253 254 14 255 256 15 257 258 16 259 260 17 261 262 18 263 264 19 265 266 20 267 268 21 269 270 22 271 272 23 273 275 24 274 276 25 277 279 26 278 280 27 281 283 28 282 284 29 285 ...
result:
ok OK 229 triangles!
Test #30:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
6480
output:
2159 2 2161 2162 3 2163 2164 4 2165 2166 5 2167 2168 6 2169 2170 7 2171 2172 8 2173 2174 9 2175 2176 10 2177 2178 11 2179 2180 12 2181 2182 13 2183 2184 14 2185 2186 15 2187 2188 16 2189 2190 17 2191 2192 18 2193 2194 19 2195 2196 20 2197 2198 21 2199 2200 22 2201 2202 23 2203 2204 24 2205 2206 25 2...
result:
ok OK 2159 triangles!
Test #31:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
1000
output:
333 2 335 336 3 337 338 4 339 340 5 341 342 6 343 344 7 345 346 8 347 348 9 349 350 10 351 352 11 353 354 12 355 356 13 357 358 14 359 360 15 361 362 16 363 364 17 365 366 18 367 368 19 369 370 20 371 372 21 373 374 22 375 376 23 377 378 24 379 380 25 381 382 26 383 384 27 385 387 28 386 388 29 389 ...
result:
ok OK 333 triangles!
Test #32:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
491
output:
163 2 165 166 3 167 168 4 169 170 5 171 172 6 173 174 7 175 176 8 177 178 9 179 180 10 181 182 11 183 184 12 185 186 13 187 188 14 189 190 15 191 192 16 193 194 17 195 196 18 197 198 19 199 200 20 201 203 21 202 204 22 205 207 23 206 208 24 209 211 25 210 212 26 213 215 27 214 216 28 217 220 29 218 ...
result:
ok OK 163 triangles!
Test #33:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
667
output:
222 2 224 225 3 226 227 4 228 229 5 230 231 6 232 233 7 234 235 8 236 237 9 238 239 10 240 241 11 242 243 12 244 245 13 246 247 14 248 249 15 250 251 16 252 253 17 254 255 18 256 257 19 258 259 20 260 261 21 262 263 22 264 265 23 266 268 24 267 269 25 270 272 26 271 273 27 274 276 28 275 277 29 278 ...
result:
ok OK 222 triangles!
Test #34:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
63
output:
20 2 22 23 3 24 25 4 26 27 5 28 29 6 30 31 7 32 33 8 34 36 9 35 37 10 38 40 11 39 41 12 42 45 13 43 46 14 44 47 15 48 51 16 49 52 17 50 53 18 54 58 19 55 59 20 56 60 21 57 61
result:
ok OK 20 triangles!
Test #35:
score: 0
Accepted
time: 1ms
memory: 3560kb
input:
682
output:
227 2 229 230 3 231 232 4 233 234 5 235 236 6 237 238 7 239 240 8 241 242 9 243 244 10 245 246 11 247 248 12 249 250 13 251 252 14 253 254 15 255 256 16 257 258 17 259 260 18 261 262 19 263 264 20 265 266 21 267 268 22 269 270 23 271 273 24 272 274 25 275 277 26 276 278 27 279 281 28 280 282 29 283 ...
result:
ok OK 227 triangles!
Test #36:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
100
output:
33 2 35 36 3 37 38 4 39 40 5 41 42 6 43 44 7 45 46 8 47 48 9 49 50 10 51 53 11 52 54 12 55 57 13 56 58 14 59 62 15 60 63 16 61 64 17 65 68 18 66 69 19 67 70 20 71 75 21 72 76 22 73 77 23 74 78 24 79 84 25 80 85 26 81 86 27 82 87 28 83 88 29 89 95 30 90 96 31 91 97 32 92 98 33 93 99 34 94 100
result:
ok OK 33 triangles!
Test #37:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
38
output:
12 2 14 15 3 16 17 4 18 19 5 20 21 6 22 23 7 24 26 8 25 27 9 28 30 10 29 31 11 32 35 12 33 36 13 34 37
result:
ok OK 12 triangles!
Test #38:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
167
output:
55 2 57 58 3 59 60 4 61 62 5 63 64 6 65 66 7 67 68 8 69 70 9 71 72 10 73 74 11 75 76 12 77 79 13 78 80 14 81 83 15 82 84 16 85 87 17 86 88 18 89 92 19 90 93 20 91 94 21 95 98 22 96 99 23 97 100 24 101 105 25 102 106 26 103 107 27 104 108 28 109 114 29 110 115 30 111 116 31 112 117 32 113 118 33 119 ...
result:
ok OK 55 triangles!
Test #39:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
34
output:
11 2 13 14 3 15 16 4 17 18 5 19 20 6 21 23 7 22 24 8 25 27 9 26 28 10 29 32 11 30 33 12 31 34
result:
ok OK 11 triangles!