UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#213180#2348. Lifestawalr02354ms772kbC++1.4kb2024-11-09 22:22:312024-11-09 23:28:02

answer

#include<cstdio>
#include<algorithm>
#define int long long
using namespace std;
const int mn=1e4+5,ml=2e3+5;
int l,q;
int a[mn],b[mn],c[mn],f[ml];
bool vis[mn];
signed main()
{
    scanf("%lld%lld",&l,&q);
    for(int i=1;i<=1e4+5;i++)
    {
        a[i]=b[i]=c[i]=l+1;
    }
    for(int i=-l;i<=l;i++)
    {
        f[i+l]=i*i*i;
    }
    // int tj=0,tk;
    for(int i=0;i<=2*l;i++)
    {
        // tk=0;
        // tj=max(tj,i);
        for(int j=i;j<=2*l;j++)
        {
            if(f[i]+f[j]>f[2*l]+10000)break;
            if(f[i]+f[j]+f[2*l]<=0)
            {
                // tj=j;
                continue;
            }
            // tk=max(tk,j);
            for(int k=j;k<=2*l;k++)
            {
                if(f[i]+f[j]+f[k]>10000)break;
                if(f[i]+f[j]+f[k]<=0)
                {
                    // tk=k;
                    continue;
                }
                if(!vis[f[i]+f[j]+f[k]])
                {
                    vis[f[i]+f[j]+f[k]]=1;
                    a[f[i]+f[j]+f[k]]=i-l;
                    b[f[i]+f[j]+f[k]]=j-l;
                    c[f[i]+f[j]+f[k]]=k-l;
                }
            }
        }
    }
    for(int i=1;i<=q;i++)
    {
        scanf("%lld",&l);
        // if(a[l]==-1)printf("-1\n");
        printf("%lld %lld %lld\r",a[l],b[l],c[l]);
    }
    return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 760kb

input:

98 10
5487
1899
3043
5373
2368
3993
723
9567
6812
901

output:

-46 -10 47\x0d-77 44 72\x0d-36 -29 42\x0d-72 45 66\x0d-12 0 16\x0d-55 44 44\x0d-77 58 64\x0d-28 12 31\x0d-66 27 65\x0d-11 -8 14...

result:

wrong output format Extra information in the output file

Test #2:

score: 0
Wrong Answer
time: 1ms
memory: 756kb

input:

99 10
6139
3749
7532
3544
3976
345
522
8442
6400
7965

output:

100 100 100\x0d100 100 100\x0d-12 -1 21\x0d-49 -40 57\x0d-58 42 50\x0d1 1 7\x0d-11 5 12\x0d-84 -47 89\x0d-24 -12 28\x0d-51 2 52...

result:

wrong output format Extra information in the output file

Test #3:

score: 0
Wrong Answer
time: 1ms
memory: 760kb

input:

98 10
5078
9597
9394
9368
8777
6955
8020
5115
398
3771

output:

99 99 99\x0d99 99 99\x0d2 5 21\x0d-42 -12 44\x0d-44 -15 46\x0d-60 26 59\x0d-9 -8 21\x0d-14 10 19\x0d-32 15 31\x0d-18 14 19\x0d-18 ...

result:

wrong output format Extra information in the output file

Test #4:

score: 0
Wrong Answer
time: 1ms
memory: 756kb

input:

91 10000
163
6364
2583
7101
5320
483
6442
1028
1209
1710
5617
296
7228
1593
4580
5559
9699
2015
6397...

output:

-76 -68 91\x0d-39 -24 43\x0d-7 9 13\x0d-27 -6 30\x0d-84 36 82\x0d-13 -4 14\x0d92 92 92\x0d-60 37 55\x0d-11 7 13\x0d-52 -35 57\x0d-...

result:

wrong output format Unexpected end of file - int32 expected

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 756kb

input:

91 10000
6480
8776
1711
1745
4845
3338
343
3167
8450
2756
2252
4375
4912
9822
8053
1533
1216
4161
61...

output:

-84 -39 87\x0d-77 61 62\x0d-54 -33 58\x0d-27 21 23\x0d-20 13 22\x0d-19 13 20\x0d-91 7 91\x0d-20 -10 23\x0d-37 -6 39\x0d6 7 13\x0d9...

result:

wrong output format Unexpected end of file - int32 expected

Test #6:

score: 0
Wrong Answer
time: 1ms
memory: 760kb

input:

95 10000
91
6885
8279
384
5310
2877
4483
2176
267
393
5446
7415
3853
4223
8480
3368
6752
9898
5779
7...

output:

-5 0 6\x0d-86 68 69\x0d-58 -36 63\x0d-52 -46 62\x0d-11 12 17\x0d2 5 14\x0d-48 -26 51\x0d-24 20 20\x0d-10 -4 11\x0d96 96 96\x0d-42 ...

result:

wrong output format Unexpected end of file - int32 expected

Test #7:

score: 0
Wrong Answer
time: 486ms
memory: 768kb

input:

952 10000
2160
9764
2079
4616
9459
4653
4400
6373
2089
7189
4202
4497
6684
119
1191
2206
9287
5365
1...

output:

-102 80 82\x0d-666 347 633\x0d-631 -357 667\x0d-748 -460 802\x0d-24 11 28\x0d-88 -35 90\x0d-30 24 26\x0d-234 -150 253\x0d-44...

result:

wrong output format Unexpected end of file - int32 expected

Test #8:

score: 0
Wrong Answer
time: 527ms
memory: 772kb

input:

992 10000
2576
3876
8352
3311
9101
5255
5420
145
7396
6040
8529
9794
5164
4302
7147
3683
152
1136
79...

output:

-302 226 252\x0d-190 119 173\x0d-874 -437 909\x0d-855 -481 903\x0d-488 -212 501\x0d-821 329 803\x0d-42 1 43\x0d-8 -7 10\x0d-...

result:

wrong output format Unexpected end of file - int32 expected

Test #9:

score: 0
Wrong Answer
time: 689ms
memory: 768kb

input:

996 10000
2189
8757
4831
6765
991
2216
9313
7968
7020
9945
988
9422
7315
2132
2333
5962
1798
8184
22...

output:

-2 0 13\x0d-300 -64 301\x0d-97 32 96\x0d-31 23 29\x0d-872 671 712\x0d-638 -170 642\x0d-447 242 422\x0d-20 7 25\x0d-663 -365 ...

result:

wrong output format Unexpected end of file - int32 expected

Test #10:

score: 0
Wrong Answer
time: 648ms
memory: 768kb

input:

988 10000
1785
1065
1261
3054
2475
693
9109
9404
1153
4364
1847
8539
4364
9471
6183
6855
303
306
635...

output:

-23 -20 28\x0d-200 121 184\x0d-439 -377 517\x0d-833 274 823\x0d-197 122 180\x0d-742 397 702\x0d-292 154 277\x0d-41 -19 44...

result:

wrong output format Unexpected end of file - int32 expected