UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213075#2348. LifeOrigami_Tobiichi30111ms3224kbC++111.0kb2024-11-09 19:12:382024-11-09 23:06:07

answer

#include <bits/stdc++.h>
using namespace std;
#define file(x) freopen(#x ".in", "r", stdin), freopen(#x ".out", "w", stdout)
#define int long long
const int N = 1e5 + 10;
int L, q;
int p[N];
map<int, pair<int, int>> mp;
signed main()
{
    // file();
    ios::sync_with_stdio(0);
    memset(p, 0x3f3f3f, sizeof(p));
    cin >> L >> q;
    if (q > 10)
        return 0;
    for (int i = -L; i <= L; ++i)
        for (int j = -L; j <= L; ++j)
            mp[i * i * i + j * j * j] = {i, j};
    for (int i = -L; i <= L; ++i)
        for (int num = 1; num <= 10000; ++num)
        {
            if (mp.count(num - (i * i * i)))
                p[num] = i;
        }
    for (int i = 1, x; i <= q; ++i)
    {
        cin >> x;
        if (abs(p[x]) > L)
            cout << L + 1 << " " << L + 1 << " " << L + 1 << endl;
        else
            cout << p[x] << " " << mp[x - p[x] * p[x] * p[x]].first << " " << mp[x - p[x] * p[x] * p[x]].second << endl;
    }
    cout << endl;
    return 0;
}

详细

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

Test #1:

score: 10
Accepted
time: 37ms
memory: 3200kb

input:

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

output:

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


result:

ok Correct!


Test #2:

score: 10
Accepted
time: 35ms
memory: 3224kb

input:

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

output:

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


result:

ok Correct!


Test #3:

score: 10
Accepted
time: 38ms
memory: 3200kb

input:

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

output:

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


result:

ok Correct!


Test #4:

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

input:

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

output:


result:

wrong output format Unexpected end of file - int32 expected

Test #5:

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

input:

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

output:


result:

wrong output format Unexpected end of file - int32 expected

Test #6:

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

input:

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

output:


result:

wrong output format Unexpected end of file - int32 expected

Test #7:

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

input:

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

output:


result:

wrong output format Unexpected end of file - int32 expected

Test #8:

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

input:

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

output:


result:

wrong output format Unexpected end of file - int32 expected

Test #9:

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

input:

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

output:


result:

wrong output format Unexpected end of file - int32 expected

Test #10:

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

input:

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

output:


result:

wrong output format Unexpected end of file - int32 expected