ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213067 | #2348. Life | 18112606231 | 60 | 282ms | 16684kb | C++11 | 1.1kb | 2024-11-09 18:59:14 | 2024-11-09 23:04:03 |
answer
#include <bits/stdc++.h>
#define int long long
#define MOD 998244353
using namespace std;
int read()
{
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')
{
x=x*10+ch-'0';
ch=getchar();
}
return x*f;
}
int q,l,x;
unordered_map<int,bool>vis;
unordered_map<int,pair<int,int>>res;
signed main()
{
l=read();
q=read();
for(int i=-l;i<=l;i++)
{
for(int j=-l;j<=l;j++)
{
vis[i*i*i+j*j*j]=true;
res[i*i*i+j*j*j]={i,j};
}
}
while(q--)
{
bool flag=false;
x=read();
for(int i=-l;i<=l;i++)
{
if(vis[x+i*i*i])
{
printf("%lld %lld %lld\n",-i,res[x+i*i*i].first,res[x+i*i*i].second);
flag=true;
break;
}
}
if(!flag)
{
printf("%lld %lld %lld\n",l+1,l+1,l+1);
}
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 3ms
memory: 2904kb
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: 8ms
memory: 3172kb
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: 7ms
memory: 2908kb
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: 10
Accepted
time: 82ms
memory: 16092kb
input:
91 10000 163 6364 2583 7101 5320 483 6442 1028 1209 1710 5617 296 7228 1593 4580 5559 9699 2015 6397...
output:
91 -68 -76 43 -24 -39 13 9 -7 30 -6 -27 82 36 -84 14 -4 -13 92 92 92 55 37 -60 13 7 -11 57 -35 -52 8...
result:
ok Correct!
Test #5:
score: 10
Accepted
time: 80ms
memory: 16092kb
input:
91 10000 6480 8776 1711 1745 4845 3338 343 3167 8450 2756 2252 4375 4912 9822 8053 1533 1216 4161 61...
output:
87 -39 -84 62 61 -77 58 -33 -54 23 21 -27 22 13 -20 20 13 -19 91 7 -91 23 -10 -20 39 -6 -37 13 7 6 9...
result:
ok Correct!
Test #6:
score: 10
Accepted
time: 102ms
memory: 16684kb
input:
95 10000 91 6885 8279 384 5310 2877 4483 2176 267 393 5446 7415 3853 4223 8480 3368 6752 9898 5779 7...
output:
6 0 -5 69 68 -86 63 -36 -58 62 -46 -52 17 12 -11 14 5 2 51 -26 -48 27 -19 -22 11 -4 -10 96 96 96 43 ...
result:
ok Correct!
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:
82 80 -102 633 347 -666 667 -357 -631 802 -460 -748 28 11 -24 90 -35 -88 26 24 -30 253 -150 -234 436...
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:
252 226 -302 173 119 -190 909 -437 -874 903 -481 -855 501 -212 -488 815 126 -816 43 1 -42 10 -7 -8 2...
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:
13 0 -2 301 -64 -300 96 32 -97 29 23 -31 712 671 -872 642 -170 -638 422 242 -447 25 7 -20 698 -365 -...
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:
28 -20 -23 184 121 -200 517 -377 -439 823 274 -833 180 122 -197 702 397 -742 277 154 -292 44 -19 -41...