QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293641#7601. IQ Testship2077WA 0ms3856kbC++14402b2023-12-29 15:13:482023-12-29 15:13:48

Judging History

你现在查看的是最新测评结果

  • [2023-12-29 15:13:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3856kb
  • [2023-12-29 15:13:48]
  • 提交

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