UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213165#2348. Lifesean138105066ms1200kbC++111.1kb2024-11-09 22:03:292024-11-09 23:25:16

answer

#include<bits/stdc++.h>
using namespace std;
int L,q,x,ff;
int main(){
    cin>>L>>q;
    while(q--){
        cin>>x;
        ff=1;
        for(int i=-L;i<=L;i++){
            int f=1;
            for(int j=i;j<=L;j++){
                int l=j,r=L,mid=0,ii=i*i*i,jj=j*j*j;
                while(l<r){
                    mid=(l+r)/2;
                    if(ii+jj+mid*mid*mid<x){
                        l=mid+1;
                    }else{
                        r=mid-1;
                    }
                }
                if(ii+l*l*l+jj==x){
                    cout<<i<<' '<<l<<' '<<j<<endl;
                    f=0;
                    break;
                }
                else if(ii+mid*mid*mid+jj==x){
                    cout<<i<<' '<<mid<<' '<<j<<endl;
                    f=0;
                    break;
                }
            }
            if(!f){
                ff=0;
                break;
            }
        }
        if(!ff){
            cout<<L+1<<' '<<L+1<<' '<<L+1<<endl;
        }
    }
    return 0;
}

详细

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

Test #1:

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

input:

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

output:

-1 14 14
99 99 99
-77 72 44
99 99 99
-72 66 45
99 99 99
-12 16 0
99 99 99
-55 44 44
99 99 99
-77 64 ...

result:

wrong answer Invalid range!

Test #2:

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

input:

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

output:

-12 21 -1
100 100 100
-49 57 -40
100 100 100
-58 50 42
100 100 100
1 7 1
100 100 100
-11 12 5
100 10...

result:

wrong answer No solution, but you output a solution!

Test #3:

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

input:

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

output:

-42 44 -12
99 99 99
-44 46 -15
99 99 99
-60 59 26
99 99 99
-14 19 10
99 99 99
-32 31 15
99 99 99
-18...

result:

wrong answer No solution, but you output a solution!

Test #4:

score: 0
Wrong Answer
time: 1664ms
memory: 1200kb

input:

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

output:

-76 91 -68
92 92 92
-21 25 0
92 92 92
-27 30 -6
92 92 92
-84 82 36
92 92 92
-13 14 -4
92 92 92
-60 5...

result:

wrong answer Invalid range!

Test #5:

score: 0
Wrong Answer
time: 1662ms
memory: 1196kb

input:

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

output:

-44 42 26
92 92 92
-77 62 61
92 92 92
-54 58 -33
92 92 92
-27 23 21
92 92 92
-19 20 13
92 92 92
-91 ...

result:

wrong answer Invalid range!

Test #6:

score: 0
Wrong Answer
time: 1740ms
memory: 1196kb

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 6 0
96 96 96
-86 69 68
96 96 96
-58 63 -36
96 96 96
-52 62 -46
96 96 96
-11 17 12
96 96 96
2 14 5...

result:

wrong answer Invalid range!

Test #7:

score: 0
Time Limit Exceeded

input:

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

output:

-18 24 -18
953 953 953
-666 633 347
953 953 953
-631 667 -357
953 953 953
-748 802 -460
953 953 953
...

result:


Test #8:

score: 0
Time Limit Exceeded

input:

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

output:

-190 173 119
993 993 993
-874 909 -437
993 993 993
-855 903 -481
993 993 993
-488 501 -212
993 993 9...

result:


Test #9:

score: 0
Time Limit Exceeded

input:

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

output:

-2 13 0
997 997 997
-300 301 -64
997 997 997
-97 96 32
997 997 997
-872 712 671
997 997 997
-638 642...

result:


Test #10:

score: 0
Time Limit Exceeded

input:

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

output:

-23 28 -20
989 989 989
-200 184 121
989 989 989
-439 517 -377
989 989 989
-833 823 274
989 989 989
-...

result: