QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293642#7601. IQ Testship2077WA 0ms3772kbC++14467b2023-12-29 15:15:352023-12-29 15:15:36

Judging History

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

  • [2023-12-29 15:15:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3772kb
  • [2023-12-29 15:15:35]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;map<int,bool>f;queue<int>q;
vector<pair<int,int>>ans;
signed main(){
	f[0]=f[1]=f[2]=1;
	cin>>n;q.push(n);
	while (!q.empty()){
		int x=q.front();q.pop();
		if (f[x]) continue;f[x]=1;
		int tmp=ceil(sqrt(x));
		ans.push_back({tmp,tmp*tmp-x});
		q.push(tmp);q.push(tmp*tmp-x);
	}
	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: 3732kb

input:

5

output:

2 0
2 1
3 4

result:

ok Successful, 3 queries

Test #2:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

7

output:

2 1
3 2

result:

ok Successful, 2 queries

Test #3:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

1

output:


result:

ok Successful, 0 queries

Test #4:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

29

output:

2 1
3 2
3 3
6 7

result:

ok Successful, 4 queries

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3680kb

input:

26

output:

2 0
2 1
4 6
3 3
6 10

result:

wrong answer a=4 and b=6 must be in S