QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#293640 | #7601. IQ Test | ship2077 | WA | 1ms | 3932kb | C++14 | 395b | 2023-12-29 15:12:06 | 2023-12-29 15:12:07 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;map<int,bool>f;
vector<pair<int,int>>ans;
void solve(int n){
if (f[n]) return ;
int x=ceil(sqrt(n));
ans.push_back({x,x*x-n});
solve(x);solve(x*x-n);
}
signed main(){
f[0]=f[1]=f[2]=1;
cin>>n;solve(n);
reverse(ans.begin(),ans.end());
for (auto [x,y]:ans)
printf("%lld %lld\n",x,y);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3836kb
input:
5
output:
2 0 2 1 3 4
result:
ok Successful, 3 queries
Test #2:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
7
output:
2 1 3 2
result:
ok Successful, 2 queries
Test #3:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
1
output:
result:
ok Successful, 0 queries
Test #4:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
29
output:
2 1 3 2 2 1 2 1 3 3 6 7
result:
ok Successful, 6 queries
Test #5:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
26
output:
2 1 2 1 3 3 2 0 4 6 2 1 2 1 3 3 6 10
result:
ok Successful, 9 queries
Test #6:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
2
output:
result:
ok Successful, 0 queries
Test #7:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
83
output:
2 1 3 1 2 0 2 1 3 4 5 8 2 1 2 1 3 3 2 0 4 6 10 17
result:
ok Successful, 12 queries
Test #8:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
13
output:
2 1 2 0 4 3
result:
ok Successful, 3 queries
Test #9:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
330
output:
2 0 2 1 3 4 2 1 2 1 3 3 6 5 2 1 2 1 3 3 2 0 2 1 3 4 5 6 19 31
result:
ok Successful, 15 queries
Test #10:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
123
output:
2 0 2 0 2 1 3 4 5 4 2 0 2 0 4 4 12 21
result:
ok Successful, 9 queries
Test #11:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
1000000000000000000
output:
2 0 2 1 2 1 3 3 6 4 2 0 2 1 3 4 2 0 4 5 11 2 119 32 2 1 2 1 3 1 8 3 2 1 3 2 2 0 2 1 3 4 5 7 2 0 4 2 14 18 178 61 31623 14129 1000000000 0
result:
ok Successful, 28 queries
Test #12:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
54
output:
2 1 2 1 3 3 2 0 4 6 2 1 3 1 8 10
result:
ok Successful, 8 queries
Test #13:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
887
output:
2 1 2 0 4 3 2 1 2 1 3 3 2 1 2 1 3 3 6 6 30 13
result:
ok Successful, 11 queries
Test #14:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
140
output:
2 0 2 0 2 0 4 4 12 4
result:
ok Successful, 5 queries
Test #15:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
365
output:
2 1 2 1 3 3 6 1 2 0 2 1 3 4 2 0 2 1 3 4 5 5 20 35
result:
ok Successful, 12 queries
Test #16:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
489
output:
2 1 3 0 2 1 3 2 7 9 2 0 2 1 3 4 5 2 23 40
result:
ok Successful, 10 queries
Test #17:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
7714
output:
2 1 2 1 3 3 2 1 2 1 3 3 6 6 2 0 2 0 4 4 2 1 2 1 3 3 2 0 4 6 10 12 88 30
result:
ok Successful, 17 queries
Test #18:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
9487
output:
2 0 2 0 2 1 3 4 2 0 4 5 11 4 2 1 2 1 3 3 2 0 4 6 10 2 98 117
result:
ok Successful, 14 queries
Test #19:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
9728
output:
2 1 3 1 2 1 3 0 9 8 2 1 2 1 3 3 2 0 4 6 10 1 99 73
result:
ok Successful, 12 queries
Test #20:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
33282
output:
2 1 3 2 2 0 2 1 3 4 5 7 2 0 4 1 15 18 2 1 2 0 4 3 2 0 4 2 14 13 183 207
result:
ok Successful, 16 queries
Test #21:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
56249
output:
2 0 2 1 3 4 2 0 2 1 3 4 2 0 2 1 3 4 5 5 20 5 2 1 3 2 2 0 2 1 3 4 5 7 2 0 4 0 16 18 238 395
result:
ok Successful, 21 queries
Test #22:
score: 0
Accepted
time: 1ms
memory: 3928kb
input:
802440
output:
2 0 2 1 3 4 5 1 2 0 2 1 3 4 2 0 2 1 3 4 5 5 20 24 2 0 2 1 2 1 3 3 2 1 2 1 3 3 6 6 30 4 896 376
result:
ok Successful, 22 queries
Test #23:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
977374
output:
2 0 2 0 4 4 2 1 3 2 7 12 2 1 3 1 2 1 2 1 3 3 6 8 28 37 2 1 2 1 3 3 6 1 2 0 2 1 2 1 3 3 6 4 32 35 989 747
result:
ok Successful, 24 queries
Test #24:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
871401
output:
2 1 2 1 3 3 2 0 2 1 3 4 2 1 2 1 3 3 6 5 31 6 2 1 3 0 2 1 2 1 3 3 6 9 2 0 2 1 3 4 2 1 2 1 3 3 6 5 31 27 934 955
result:
ok Successful, 26 queries
Test #25:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
7795432
output:
2 0 2 1 3 4 2 1 3 1 8 5 2 1 3 2 2 1 3 0 9 7 74 59 2 0 4 0 2 0 2 1 3 4 2 0 4 5 2 1 3 1 8 11 53 16 2793 5417
result:
ok Successful, 24 queries
Test #26:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
363887
output:
2 0 2 1 2 1 3 3 6 4 2 0 2 1 3 4 2 1 2 1 3 3 6 5 31 32 2 0 2 0 2 1 3 4 5 4 2 0 2 1 3 4 5 0 25 21 604 929
result:
ok Successful, 24 queries
Test #27:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
3117943
output:
2 1 3 1 2 1 2 1 3 3 6 8 2 1 3 2 2 1 2 1 3 3 6 7 29 28 2 1 3 1 2 0 2 1 3 4 5 8 2 1 2 1 3 3 2 0 4 6 10 17 2 1 2 1 3 3 2 1 3 2 7 6 43 83 1766 813
result:
ok Successful, 33 queries
Test #28:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
27832185
output:
2 0 4 0 2 0 2 1 3 4 2 0 4 5 11 16 2 1 3 1 8 0 64 105 2 0 2 1 3 4 2 0 4 5 2 1 3 1 8 11 2 1 3 1 2 1 3 0 9 8 73 53 5276 3991
result:
ok Successful, 27 queries
Test #29:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
92676068
output:
2 1 2 1 3 3 2 1 3 0 9 6 2 1 3 1 2 1 3 1 8 8 56 75 2 1 2 0 2 1 3 4 5 3 2 0 4 2 14 22 2 1 2 1 3 3 2 0 4 6 10 1 99 174 9627 3061
result:
ok Successful, 28 queries
Test #30:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
31987960
output:
2 0 2 1 3 4 5 0 2 1 3 2 7 0 49 25 2 0 2 1 3 4 2 0 4 5 11 1 2 0 2 1 3 4 2 1 3 0 9 5 76 120 5656 2376
result:
ok Successful, 22 queries
Test #31:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
547044556
output:
2 1 2 1 3 3 2 0 2 1 3 4 5 6 2 1 3 1 2 1 2 1 3 3 6 8 28 19 2 0 2 1 3 4 2 0 2 1 3 4 5 5 2 0 4 0 2 1 2 0 4 3 13 16 153 20 23389 765
result:
ok Successful, 29 queries
Test #32:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
464667912
output:
2 0 2 0 4 4 12 0 2 0 2 1 3 4 2 0 4 2 14 5 191 144 2 0 2 0 4 4 2 1 3 1 8 12 2 1 2 0 2 1 3 4 5 3 2 1 2 0 4 3 13 22 147 52 21557 36337
result:
ok Successful, 28 queries
Test #33:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
251796962
output:
2 0 2 1 3 4 5 0 2 1 2 0 4 3 13 1 168 25 2 1 3 2 2 1 3 2 2 0 2 1 3 4 5 7 2 0 2 0 4 4 12 18 126 7 15869 28199
result:
ok Successful, 23 queries
Test #34:
score: -100
Wrong Answer
time: 0ms
memory: 3844kb
input:
8591505981
output:
2 1 2 1 3 3 2 0 4 6 10 0 2 0 2 0 2 1 3 4 5 4 2 1 2 1 3 3 2 0 2 1 3 4 5 6 19 21 340 100 2 1 3 0 2 1 2 1 3 3 6 9 2 1 2 1 3 3 2 0 2 1 3 4 5 6 19 27 2 1 2 1 3 3 2 0 2 1 3 4 5 6 2 1 3 2 2 0 2 1 3 4 5 7 18 19 305 334 92691 115500
result:
wrong answer Solution made 50 queries => exceeds 43