QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293893#7601. IQ TestcghAndyWA 1ms3604kbC++14353b2023-12-29 22:14:362023-12-29 22:14:36

Judging History

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

  • [2023-12-29 22:14:36]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3604kb
  • [2023-12-29 22:14:36]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
bool dfs(long long n,int k){
	if(n<=2) return true;
	if(k>=43) return false;
	long long x=sqrt(n);
	if(x*x<n) x++;
	for(;;x++){
		long long y=x*x-n;
		if(dfs(x,k+1)&&dfs(y,k+1)){
			cout<<x<<" "<<y<<endl;
			return true;
		}
	}
}
int main(){
	long long n;
	cin>>n;
	dfs(n,0);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3424kb

input:

5

output:

2 1
2 0
3 4

result:

ok Successful, 3 queries

Test #2:

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

input:

7

output:

2 1
3 2

result:

ok Successful, 2 queries

Test #3:

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

input:

1

output:


result:

ok Successful, 0 queries

Test #4:

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

input:

29

output:

2 1
2 1
3 3
2 1
3 2
6 7

result:

ok Successful, 6 queries

Test #5:

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

input:

26

output:

2 1
2 1
3 3
2 0
2 1
2 1
3 3
4 6
6 10

result:

ok Successful, 9 queries

Test #6:

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

input:

2

output:


result:

ok Successful, 0 queries

Test #7:

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

input:

83

output:

2 0
2 1
2 1
3 3
4 6
2 1
2 0
3 4
2 1
3 1
5 8
10 17

result:

ok Successful, 12 queries

Test #8:

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

input:

13

output:

2 0
2 1
4 3

result:

ok Successful, 3 queries

Test #9:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

330

output:

2 1
2 0
3 4
2 1
2 1
3 3
5 6
2 1
2 1
3 3
2 1
2 0
3 4
6 5
19 31

result:

ok Successful, 15 queries

Test #10:

score: 0
Accepted
time: 1ms
memory: 3480kb

input:

123

output:

2 0
2 0
4 4
2 1
2 0
3 4
2 0
5 4
12 21

result:

ok Successful, 9 queries

Test #11:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

1000000000000000000

output:

2 0
4 2
2 1
2 0
3 4
2 1
3 2
5 7
14 18
2 1
3 1
2 1
8 3
178 61
2 0
2 1
2 0
3 4
4 5
11 2
2 1
2 1
3 3
2 0
6 4
119 32
31623 14129
1000000000 0

result:

ok Successful, 28 queries

Test #12:

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

input:

54

output:

2 1
3 1
2 0
2 1
2 1
3 3
4 6
8 10

result:

ok Successful, 8 queries

Test #13:

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

input:

887

output:

2 1
2 1
3 3
2 1
2 1
3 3
6 6
2 0
2 1
4 3
30 13

result:

ok Successful, 11 queries

Test #14:

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

input:

140

output:

2 0
2 0
4 4
2 0
12 4

result:

ok Successful, 5 queries

Test #15:

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

input:

365

output:

2 1
2 0
3 4
2 1
2 0
3 4
5 5
2 1
2 1
3 3
6 1
20 35

result:

ok Successful, 12 queries

Test #16:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

489

output:

2 1
2 0
3 4
5 2
2 1
3 2
2 1
3 0
7 9
23 40

result:

ok Successful, 10 queries

Test #17:

score: 0
Accepted
time: 1ms
memory: 3428kb

input:

7714

output:

2 0
2 1
2 1
3 3
4 6
2 0
2 0
4 4
10 12
2 1
2 1
3 3
2 1
2 1
3 3
6 6
88 30

result:

ok Successful, 17 queries

Test #18:

score: 0
Accepted
time: 1ms
memory: 3376kb

input:

9487

output:

2 0
2 1
2 1
3 3
4 6
10 2
2 0
2 1
2 0
3 4
4 5
2 0
11 4
98 117

result:

ok Successful, 14 queries

Test #19:

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

input:

9728

output:

2 0
2 1
2 1
3 3
4 6
10 1
2 1
3 0
2 1
3 1
9 8
99 73

result:

ok Successful, 12 queries

Test #20:

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

input:

33282

output:

2 0
4 2
2 0
2 1
4 3
14 13
2 0
4 1
2 1
2 0
3 4
2 1
3 2
5 7
15 18
183 207

result:

ok Successful, 16 queries

Test #21:

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

input:

56249

output:

2 0
4 0
2 1
2 0
3 4
2 1
3 2
5 7
16 18
2 1
2 0
3 4
2 1
2 0
3 4
5 5
2 1
2 0
3 4
20 5
238 395

result:

ok Successful, 21 queries

Test #22:

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

input:

802440

output:

2 1
2 1
3 3
2 1
2 1
3 3
6 6
2 0
30 4
2 1
2 0
3 4
2 1
2 0
3 4
5 5
2 1
2 0
3 4
5 1
20 24
896 376

result:

ok Successful, 22 queries

Test #23:

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

input:

977374

output:

2 1
2 1
3 3
2 0
6 4
2 1
2 1
3 3
6 1
32 35
2 1
2 1
3 3
2 1
3 1
6 8
2 1
3 2
2 0
2 0
4 4
7 12
28 37
989 747

result:

ok Successful, 24 queries

Test #24:

score: 0
Accepted
time: 1ms
memory: 3604kb

input:

871401

output:

2 1
2 1
3 3
2 1
2 0
3 4
6 5
2 1
2 1
3 3
2 1
3 0
6 9
31 27
2 1
2 1
3 3
2 1
2 0
3 4
6 5
2 1
2 1
3 3
31 6
934 955

result:

ok Successful, 26 queries

Test #25:

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

input:

7795432

output:

2 1
3 1
2 0
2 1
2 0
3 4
4 5
8 11
2 0
4 0
53 16
2 1
3 0
2 1
3 2
9 7
2 1
3 1
2 1
2 0
3 4
8 5
74 59
2793 5417

result:

ok Successful, 24 queries

Test #26:

score: 0
Accepted
time: 1ms
memory: 3424kb

input:

363887

output:

2 1
2 0
3 4
5 0
2 1
2 0
3 4
2 0
5 4
25 21
2 1
2 1
3 3
2 1
2 0
3 4
6 5
2 1
2 1
3 3
2 0
6 4
31 32
604 929

result:

ok Successful, 24 queries

Test #27:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

3117943

output:

2 1
3 2
2 1
2 1
3 3
7 6
2 0
2 1
2 1
3 3
4 6
2 1
2 0
3 4
2 1
3 1
5 8
10 17
43 83
2 1
2 1
3 3
2 1
3 2
6 7
2 1
2 1
3 3
2 1
3 1
6 8
29 28
1766 813

result:

ok Successful, 33 queries

Test #28:

score: 0
Accepted
time: 1ms
memory: 3440kb

input:

27832185

output:

2 1
3 0
2 1
3 1
9 8
2 1
3 1
2 0
2 1
2 0
3 4
4 5
8 11
73 53
2 1
3 1
8 0
2 0
2 1
2 0
3 4
4 5
2 0
4 0
11 16
64 105
5276 3991

result:

ok Successful, 27 queries

Test #29:

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

input:

92676068

output:

2 0
2 1
2 1
3 3
4 6
10 1
2 0
4 2
2 1
2 0
3 4
2 1
5 3
14 22
99 174
2 1
3 1
2 1
3 1
8 8
2 1
3 0
2 1
2 1
3 3
9 6
56 75
9627 3061

result:

ok Successful, 28 queries

Test #30:

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

input:

31987960

output:

2 1
3 0
2 1
2 0
3 4
9 5
2 0
2 1
2 0
3 4
4 5
11 1
76 120
2 1
3 2
7 0
2 1
2 0
3 4
5 0
49 25
5656 2376

result:

ok Successful, 22 queries

Test #31:

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

input:

547044556

output:

2 0
2 1
4 3
2 0
4 0
13 16
2 1
2 0
3 4
2 1
2 0
3 4
5 5
153 20
2 1
2 1
3 3
2 1
3 1
6 8
2 1
2 0
3 4
2 1
2 1
3 3
5 6
28 19
23389 765

result:

ok Successful, 29 queries

Test #32:

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

input:

464667912

output:

2 0
2 1
4 3
2 1
2 0
3 4
2 1
5 3
13 22
2 1
3 1
2 0
2 0
4 4
8 12
147 52
2 0
4 2
2 1
2 0
3 4
14 5
2 0
2 0
4 4
12 0
191 144
21557 36337

result:

ok Successful, 28 queries

Test #33:

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

input:

251796962

output:

2 0
2 0
4 4
2 1
2 0
3 4
2 1
3 2
5 7
12 18
2 1
3 2
126 7
2 0
2 1
4 3
13 1
2 1
2 0
3 4
5 0
168 25
15869 28199

result:

ok Successful, 23 queries

Test #34:

score: -100
Wrong Answer
time: 1ms
memory: 3380kb

input:

8591505981

output:

2 1
2 0
3 4
2 1
3 2
5 7
2 1
2 0
3 4
2 1
2 1
3 3
5 6
18 19
2 1
2 0
3 4
2 1
2 1
3 3
5 6
2 1
2 1
3 3
2 1
3 0
6 9
19 27
305 334
2 1
2 0
3 4
2 1
2 1
3 3
5 6
2 1
2 0
3 4
2 0
5 4
19 21
2 0
2 1
2 1
3 3
4 6
10 0
340 100
92691 115500

result:

wrong answer Solution made 50 queries => exceeds 43