QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#293641 | #7601. IQ Test | ship2077 | WA | 0ms | 3856kb | C++14 | 402b | 2023-12-29 15:13:48 | 2023-12-29 15:13:48 |
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});f[n]=1;
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: 0ms
memory: 3684kb
input:
5
output:
2 0 2 1 3 4
result:
ok Successful, 3 queries
Test #2:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
7
output:
2 1 3 2
result:
ok Successful, 2 queries
Test #3:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1
output:
result:
ok Successful, 0 queries
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3692kb
input:
29
output:
3 2 2 1 3 3 6 7
result:
wrong answer a=3 and b=2 must be in S