ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#213172 | #2348. Life | liuqichen121 | 20 | 854ms | 1396kb | C++ | 1.5kb | 2024-11-09 22:12:15 | 2024-11-09 23:26:42 |
answer
#include<algorithm>
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<string>
#include<vector>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
int read(){
int s=0,f=1;
char _z=getchar();
while(_z<'0'||_z>'9'){
if(_z=='-')
f=-1;
_z=getchar();
}
while(_z>='0'&&_z<='9'){
s=(s<<3)+(s<<1)+(_z-'0');
_z=getchar();
}
return s*f;
}
const int N=1e4+10,L=1e3+10;
typedef long long ll;
struct name{
ll a,b,c;
}na[N];
bool pd[N];
int main(){
ll l=read(),q=read();
for(ll a=-l;a<=l;a++){
for(ll b=-l;b<=l;b++){
ll c=0;
ll lll=-l,rrr=l,mid;
while(lll<rrr){
mid=(lll+rrr)>>1;
if(mid*mid*mid<-(a*a*a+b*b*b))
lll=mid+1;
else
rrr=mid;
}
c=max(lll-10,-l);
while(a*a*a+b*b*b+c*c*c<=1e4){
if(a*a*a+b*b*b+c*c*c>0&&!pd[a*a*a+b*b*b+c*c*c]){
pd[a*a*a+b*b*b+c*c*c]=true;
na[a*a*a+b*b*b+c*c*c]=(name){a,b,c};
}
c++;
}
}
}
while(q--){
int x=read();
if(pd[x]){
printf("%lld %lld %lld\n",na[x].a,na[x].b,na[x].c);
}else{
printf("%lld %lld %lld\n",l+1,l+1,l+1);
}
}
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 1392kb
input:
98 10 5487 1899 3043 5373 2368 3993 723 9567 6812 901
output:
-46 -10 47 -77 44 72 -36 -29 42 -72 45 66 -12 0 16 -55 44 44 -77 58 64 -28 12 31 -97 -59 104 -11 -8 14
result:
wrong answer Invalid range!
Test #2:
score: 10
Accepted
time: 0ms
memory: 1392kb
input:
99 10 6139 3749 7532 3544 3976 345 522 8442 6400 7965
output:
100 100 100 100 100 100 -12 -1 21 -49 -40 57 -58 42 50 1 1 7 -11 5 12 -84 -47 89 -24 -12 28 -51 2 52
result:
ok Correct!
Test #3:
score: 10
Accepted
time: 3ms
memory: 1396kb
input:
98 10 5078 9597 9394 9368 8777 6955 8020 5115 398 3771
output:
99 99 99 99 99 99 2 5 21 -42 -12 44 -44 -15 46 -60 26 59 -9 -8 21 -14 10 19 -32 15 31 -18 14 19
result:
ok Correct!
Test #4:
score: 0
Wrong Answer
time: 5ms
memory: 1392kb
input:
91 10000 163 6364 2583 7101 5320 483 6442 1028 1209 1710 5617 296 7228 1593 4580 5559 9699 2015 6397...
output:
-76 -68 91 -39 -24 43 -7 9 13 -27 -6 30 -84 36 82 -13 -4 14 92 92 92 -60 37 55 -11 7 13 -52 -35 57 -...
result:
wrong answer Invalid range!
Test #5:
score: 0
Wrong Answer
time: 2ms
memory: 1392kb
input:
91 10000 6480 8776 1711 1745 4845 3338 343 3167 8450 2756 2252 4375 4912 9822 8053 1533 1216 4161 61...
output:
-84 -39 87 -77 61 62 -54 -33 58 -27 21 23 -20 13 22 -19 13 20 -91 7 91 -20 -10 23 -37 -6 39 6 7 13 9...
result:
wrong answer Invalid range!
Test #6:
score: 0
Wrong Answer
time: 5ms
memory: 1392kb
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 0 6 -86 68 69 -58 -36 63 -52 -46 62 -11 12 17 2 5 14 -48 -26 51 -24 20 20 -10 -4 11 96 96 96 -42 ...
result:
wrong answer No solution, but you output a solution!
Test #7:
score: 0
Wrong Answer
time: 195ms
memory: 1392kb
input:
952 10000 2160 9764 2079 4616 9459 4653 4400 6373 2089 7189 4202 4497 6684 119 1191 2206 9287 5365 1...
output:
-102 80 82 -666 347 633 -631 -357 667 -748 -460 802 -24 11 28 -88 -35 90 -30 24 26 -234 -150 253 -44...
result:
wrong answer Invalid range!
Test #8:
score: 0
Wrong Answer
time: 213ms
memory: 1392kb
input:
992 10000 2576 3876 8352 3311 9101 5255 5420 145 7396 6040 8529 9794 5164 4302 7147 3683 152 1136 79...
output:
-302 226 252 -190 119 173 -874 -437 909 -855 -481 903 -488 -212 501 -821 329 803 -42 1 43 -8 -7 10 -...
result:
wrong answer Invalid range!
Test #9:
score: 0
Wrong Answer
time: 216ms
memory: 1392kb
input:
996 10000 2189 8757 4831 6765 991 2216 9313 7968 7020 9945 988 9422 7315 2132 2333 5962 1798 8184 22...
output:
-2 0 13 -300 -64 301 -97 32 96 -31 23 29 -872 671 712 -638 -170 642 -447 242 422 -20 7 25 -942 -923 ...
result:
wrong answer Invalid range!
Test #10:
score: 0
Wrong Answer
time: 212ms
memory: 1392kb
input:
988 10000 1785 1065 1261 3054 2475 693 9109 9404 1153 4364 1847 8539 4364 9471 6183 6855 303 306 635...
output:
-23 -20 28 -200 121 184 -439 -377 517 -833 274 823 -197 122 180 -742 397 702 -292 154 277 -41 -19 44...
result:
wrong answer Invalid range!