ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213135 | #2348. Life | yanruo_BGSSR_ypa | 100 | 3965ms | 1472kb | C++11 | 661b | 2024-11-09 21:00:23 | 2024-11-09 23:18:44 |
answer
#include<bits/stdc++.h>
#define p3(x) x*x*x
using namespace std;
int L,q,x[100001],mx,p[100001][2];
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>L>>q;
for(int i=1;i<=q;i++)cin>>x[i],mx=max(mx,x[i]);
for(int i=1;i<=mx;i++)p[i][0]=L+1;
for(int i=-L;i<=L;i++)
for(int j=-abs(i);j<=abs(i);j++)
for(int k=-abs(j),s;k<=abs(j);k++){
s=i*i*i+j*j*j+k*k*k;
if(1<=s&&s<=mx&&abs(p[s][0])>abs(i))p[s][0]=i,p[s][1]=j;
}
for(int i=1;i<=q;i++){
if(abs(p[x[i]][0])>L)cout<<L+1<<' '<<L+1<<' '<<L+1<<'\n';
else cout<<p[x[i]][0]<<' '<<p[x[i]][1]<<' '<<cbrt(x[i]-p3(p[x[i]][0])-p3(p[x[i]][1]))<<'\n';
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1420kb
input:
98 10 5487 1899 3043 5373 2368 3993 723 9567 6812 901
output:
14 14 -1 16 -13 0 34 -30 -21 24 -22 13 16 -12 0 11 11 11 -77 64 58 31 -28 12 17 16 -13 14 -11 -8
result:
ok Correct!
Test #2:
score: 10
Accepted
time: 2ms
memory: 1408kb
input:
99 10 6139 3749 7532 3544 3976 345 522 8442 6400 7965
output:
100 100 100 100 100 100 17 14 -5 15 8 -7 50 -49 -15 7 1 1 12 -11 5 21 -11 8 28 -24 -12 18 13 -4
result:
ok Correct!
Test #3:
score: 10
Accepted
time: 2ms
memory: 1420kb
input:
98 10 5078 9597 9394 9368 8777 6955 8020 5115 398 3771
output:
99 99 99 99 99 99 21 5 2 35 -27 -24 31 -29 15 26 -22 3 21 -9 -8 19 -14 10 -11 10 9 14 10 3
result:
ok Correct!
Test #4:
score: 10
Accepted
time: 5ms
memory: 1472kb
input:
91 10000 163 6364 2583 7101 5320 483 6442 1028 1209 1710 5617 296 7228 1593 4580 5559 9699 2015 6397...
output:
30 -26 -21 23 -20 13 12 8 7 30 -27 -6 17 7 4 14 -13 -4 92 92 92 10 3 1 13 -11 7 57 -52 -35 18 -6 1 8...
result:
ok Correct!
Test #5:
score: 10
Accepted
time: 7ms
memory: 1472kb
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 21 -8 3 15 -12 4 14 -12 9 22 -20 13 15 -4 3 -7 7 7 15 -6 2 22 -13 -1 13 7 6 92 92 92 15 10...
result:
ok Correct!
Test #6:
score: 10
Accepted
time: 7ms
memory: 1472kb
input:
95 10000 91 6885 8279 384 5310 2877 4483 2176 267 393 5446 7415 3853 4223 8480 3368 6752 9898 5779 7...
output:
4 3 0 19 3 -1 20 7 -4 8 -4 -4 17 12 -11 14 5 2 16 8 -5 12 8 -4 11 -10 -4 96 96 96 15 12 7 50 -49 4 1...
result:
ok Correct!
Test #7:
score: 10
Accepted
time: 893ms
memory: 1472kb
input:
952 10000 2160 9764 2079 4616 9459 4653 4400 6373 2089 7189 4202 4497 6684 119 1191 2206 9287 5365 1...
output:
12 6 6 27 -22 9 12 7 2 15 9 8 28 -24 11 21 -16 -8 17 -9 6 253 -234 -150 121 -96 -96 21 -13 5 14 9 9 ...
result:
ok Correct!
Test #8:
score: 10
Accepted
time: 1010ms
memory: 1472kb
input:
992 10000 2576 3876 8352 3311 9101 5255 5420 145 7396 6040 8529 9794 5164 4302 7147 3683 152 1136 79...
output:
18 -14 -8 38 -37 -7 17 15 4 15 -4 0 22 -11 -6 17 7 -1 43 -42 1 10 -8 -7 20 -9 5 16 12 6 359 -355 -11...
result:
ok Correct!
Test #9:
score: 10
Accepted
time: 1021ms
memory: 1472kb
input:
996 10000 2189 8757 4831 6765 991 2216 9313 7968 7020 9945 988 9422 7315 2132 2333 5962 1798 8184 22...
output:
13 -2 0 21 -8 2 15 11 5 -31 29 23 10 -2 -1 10 10 6 393 -391 -97 22 -14 4 27 -26 17 41 -39 7 11 -7 0 ...
result:
ok Correct!
Test #10:
score: 10
Accepted
time: 1018ms
memory: 1472kb
input:
988 10000 1785 1065 1261 3054 2475 693 9109 9404 1153 4364 1847 8539 4364 9471 6183 6855 303 306 635...
output:
28 -23 -20 10 4 1 13 -10 4 -833 823 274 -37 34 24 -56 45 44 21 -6 4 23 -19 16 -42 34 33 18 -13 9 -92...
result:
ok Correct!
Extra Test:
score: 0
Extra Test Passed