UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213097#2348. LifeKXG805294ms78000kbC++11815b2024-11-09 19:56:482024-11-09 23:09:26

answer

#include <cstdio>
#include <unordered_map>
using namespace std;
unordered_map<long long, pair<int, int> > mp;
long long l, q, x;
long long calc(long long x) {
    return x * x * x;
}
int main() {
    scanf("%lld%lld", &l, &q);
    for (int i = -l; i <= l; i++) {
        for (int j = -l; j <= l; j++) {
            mp[calc(i) + calc(j)] = {i, j};
        }
    }
    for (int i = 1; i <= q; i++) {
        scanf("%lld", &x);
        int a = l + 1, b = l + 1, c = l + 1;
        for (int j = -l; j <= l; j++) {
            long long sub = x - calc(j);
            if (mp.count(sub)) {
                a = mp[sub].second;
                b = mp[sub].first;
                c = j;
                break;
            }
        }
        printf("%d %d %d\n", a, b, c);
    }
    return 0;
}

详细

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

Test #1:

score: 10
Accepted
time: 2ms
memory: 1852kb

input:

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

output:

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

result:

ok Correct!


Test #2:

score: 10
Accepted
time: 3ms
memory: 1856kb

input:

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

output:

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

result:

ok Correct!


Test #3:

score: 10
Accepted
time: 0ms
memory: 1856kb

input:

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

output:

99 99 99
99 99 99
5 21 2
-12 44 -42
-15 46 -44
26 59 -60
-8 21 -9
10 19 -14
15 31 -32
14 19 -18

result:

ok Correct!


Test #4:

score: 10
Accepted
time: 30ms
memory: 1852kb

input:

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

output:

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

result:

ok Correct!


Test #5:

score: 10
Accepted
time: 29ms
memory: 1852kb

input:

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

output:

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

result:

ok Correct!


Test #6:

score: 10
Accepted
time: 27ms
memory: 1852kb

input:

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

output:

0 6 -5
68 69 -86
-36 63 -58
-46 62 -52
12 17 -11
5 14 2
-26 51 -48
20 20 -24
-4 11 -10
96 96 96
3 43...

result:

ok Correct!


Test #7:

score: 10
Accepted
time: 2662ms
memory: 73780kb

input:

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

output:

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

result:

ok Correct!


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:

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

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:

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

result:


Test #10:

score: 10
Accepted
time: 2541ms
memory: 78000kb

input:

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

output:

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

result:

ok Correct!