ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213111 | #2348. Life | one_zero_four_zero | 0 | 1181ms | 1200kb | C++11 | 1.1kb | 2024-11-09 20:12:53 | 2024-11-09 23:12:49 |
answer
#include<bits/stdc++.h>
#pragma GCC optimize(2)
#define qpow(x) ((x * x * x))
using namespace std;
struct node{
int val1, val2, val3;
};
int L, Q, x;
node ans[100005];
int binary(int x){
int l = -L, r = L, res = 0;
while (l <= r){
int mid = (l + r) >> 1;
if (qpow(mid) >= x){
res = mid;
r = mid - 1;
}else{
l = mid + 1;
}
}
return res;
}
void __init(){
for (int i = 1; i <= L; i ++){
ans[i].val1 = L + 1, ans[i].val2 = L + 1, ans[i].val3 = L + 1;
}
for (int i = -L; i <= L; i ++){
for (int j = -L; j <= L; j ++){
int nw = qpow(i) + qpow(j);
int st = binary(-nw), en = binary(L -nw + 1);
for (int k = st; k <= en; k ++){
int tmp = qpow(i) + qpow(j) + qpow(k);
if (tmp < 1 || tmp > L) continue;
ans[tmp].val1 = i, ans[tmp].val2 = j, ans[tmp].val3 = k;
}
}
}
}
int main(){
#ifndef ONLINE_JUDGE
freopen("../data.in", "r", stdin);
freopen("../data.out", "w", stdout);
#endif
scanf("%d %d", &L, &Q);
__init();
while (Q --){
scanf("%d", &x);
printf("%d %d %d\n", ans[x].val1, ans[x].val2, ans[x].val3);
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 1192kb
input:
98 10 5487 1899 3043 5373 2368 3993 723 9567 6812 901
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
wrong answer a^3 + b^3 + c^3 != x
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 1192kb
input:
99 10 6139 3749 7532 3544 3976 345 522 8442 6400 7965
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
wrong answer No solution, but you output a solution!
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 1188kb
input:
98 10 5078 9597 9394 9368 8777 6955 8020 5115 398 3771
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
wrong answer No solution, but you output a solution!
Test #4:
score: 0
Wrong Answer
time: 4ms
memory: 1192kb
input:
91 10000 163 6364 2583 7101 5320 483 6442 1028 1209 1710 5617 296 7228 1593 4580 5559 9699 2015 6397...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer a^3 + b^3 + c^3 != x
Test #5:
score: 0
Wrong Answer
time: 2ms
memory: 1188kb
input:
91 10000 6480 8776 1711 1745 4845 3338 343 3167 8450 2756 2252 4375 4912 9822 8053 1533 1216 4161 61...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer a^3 + b^3 + c^3 != x
Test #6:
score: 0
Wrong Answer
time: 3ms
memory: 1192kb
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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
wrong answer a^3 + b^3 + c^3 != x
Test #7:
score: 0
Wrong Answer
time: 275ms
memory: 1200kb
input:
952 10000 2160 9764 2079 4616 9459 4653 4400 6373 2089 7189 4202 4497 6684 119 1191 2206 9287 5365 1...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 -8 -14 0 0 0 0 0 0 ...
result:
wrong answer a^3 + b^3 + c^3 != x
Test #8:
score: 0
Wrong Answer
time: 297ms
memory: 1196kb
input:
992 10000 2576 3876 8352 3311 9101 5255 5420 145 7396 6040 8529 9794 5164 4302 7147 3683 152 1136 79...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 -7 -8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7...
result:
wrong answer a^3 + b^3 + c^3 != x
Test #9:
score: 0
Wrong Answer
time: 304ms
memory: 1200kb
input:
996 10000 2189 8757 4831 6765 991 2216 9313 7968 7020 9945 988 9422 7315 2132 2333 5962 1798 8184 22...
output:
0 0 0 0 0 0 0 0 0 0 0 0 712 671 -872 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 695 453 -754 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer a^3 + b^3 + c^3 != x
Test #10:
score: 0
Wrong Answer
time: 294ms
memory: 1196kb
input:
988 10000 1785 1065 1261 3054 2475 693 9109 9404 1153 4364 1847 8539 4364 9471 6183 6855 303 306 635...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 702 397 -742 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
wrong answer a^3 + b^3 + c^3 != x