QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#900517#10087. Archaeology呆呆鸟 (Weicheng Wang, Anyi Xu, Xiangwen Wang)#AC ✓3ms3968kbC++235.2kb2025-02-15 16:04:282025-02-15 16:04:28

Judging History

This is the latest submission verdict.

  • [2025-02-15 16:04:28]
  • Judged
  • Verdict: AC
  • Time: 3ms
  • Memory: 3968kb
  • [2025-02-15 16:04:28]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define mod 998244353
#define ll long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
void print(vector<int> x){for(int i=0;i<(int)x.size();i++) printf("%d%c",x[i]," \n"[i==(int)x.size()-1]);}
using db=long double;
const db eps=1e-8;
int sgn(db x)
{
	if(x<-eps) return -1;
	else if(x>eps) return 1;
	else return 0;
}
struct Vec
{
	db x,y;
	Vec(db a=0,db b=0) {x=a,y=b;}
	db norm() {return x*x+y*y;}
	db abs() {return sqrt(x*x+y*y);}
};
Vec operator + (const Vec &x,const Vec &y) {return Vec(x.x+y.x,x.y+y.y);}
Vec operator - (const Vec &x,const Vec &y) {return Vec(x.x-y.x,x.y-y.y);}
Vec operator * (const Vec &x,const db y) {return Vec(x.x*y,x.y*y);}
Vec operator / (const Vec &x,const db y) {return Vec(x.x/y,x.y/y);}
db dis(const Vec &x,const Vec &y) {return (x-y).abs();}
db dis(const Vec &x) {return sqrt(x.x*x.x+x.y*x.y);}
void print(Vec x) {printf("%.10Lf %.10Lf\n",x.x,x.y);}
db cdot(const Vec &x,const Vec &y) {return x.x*y.x+x.y*y.y;}
db cross(const Vec &x,const Vec &y) {return x.x*y.y-x.y*y.x;}
int ccw(const Vec &x,const Vec &y,const Vec &z)
{
	int w=sgn(cross(y-x,z-x));
	if(w==1) return 1; // ccw
	else if(w==-1) return -1; // cw;
	else return 0; // coline
}
struct Seg
{
	Vec s,t; // two points
	Seg(Vec x,Vec y) {s=x,t=y;}
	Seg() {}
	Vec d() {return t-s;}
	Vec point(db p) {return s+(t-s)*p;}
};
int parallel(Seg p,Seg q) {return sgn(cross(p.d(),q.d()))==0;}
Vec proj(Seg l,Vec x)
{
	db p=cdot(l.t-l.s,x-l.s)/(l.t-l.s).norm();
	return l.point(p);
}
int isintersect(Seg p,Seg q)
{
	if(max(p.s.x,p.t.x)<min(q.s.x,q.t.x)) return 0;
	if(max(q.s.x,q.t.x)<min(p.s.x,p.t.x)) return 0;
	if(max(p.s.y,p.t.y)<min(q.s.y,q.t.y)) return 0;
	if(max(q.s.y,q.t.y)<min(p.s.y,p.t.y)) return 0;
	if(ccw(q.s,p.s,p.t)*ccw(q.t,p.s,p.t)==1) return 0;
	if(ccw(p.s,q.s,q.t)*ccw(p.t,q.s,q.t)==1) return 0;
	return 1;
}
Vec crosspoint(Seg p,Seg q)
{
	db A=cross(p.t-p.s,q.t-q.s);
	db B=cross(p.t-p.s,p.t-q.s);
	return q.s+(q.t-q.s)*(B/A);
}
Vec r90(Vec x) {return Vec(-x.y,x.x);}
// counter-clockwise halfplanes
// return counter-clockwise
vector<Vec> halfPlane(vector<Seg> v)
{
	sort(v.begin(),v.end(),[&](Seg x,Seg y){
		db ang1=atan2(x.d().y,x.d().x);
		db ang2=atan2(y.d().y,y.d().x);
		if(sgn(ang1-ang2)) return ang1<ang2;
		else return ccw(x.s,y.s,y.t)==1;
	});
	auto onRight=[&](Seg s,Vec x) {return ccw(s.s,x,s.t)>=0;};
	static Seg q[1005];
	static Vec p[1005];
	int l=0,r=0; q[0]=v[0];
	for(int i=1;i<(int)v.size();i++)
	{
		while(l<r&&onRight(v[i],p[r])) r--;
		while(l<r&&onRight(v[i],p[l+1])) l++;
		q[++r]=v[i];
		if(parallel(q[r],q[r-1]))
		{
			if(onRight(q[r],q[r-1].s)&&cdot(q[r].d(),q[r-1].d())<eps) return {};
			r--;
			if(!onRight(q[r],v[i].s)) q[r]=v[i];
		}
		if(l<r) p[r]=crosspoint(q[r],q[r-1]);
	}
	while(l<r&&onRight(q[l],p[r])) r--;
	if(r-l<=1) return {};
	p[l]=crosspoint(q[l],q[r]);
	return vector<Vec>(p+l,p+r+1);
}
const int L=90;
int N,keyx,keyy;
int cnt=0;
vector<Seg> a;
Vec query(int x,int y)
{
	printf("%d %d\n",x,y); fflush(stdout);
	cnt++;
#ifdef wasa855
	printf("**** %d\n",cnt);
	if(x==keyx&&y==keyy) exit(0);
	return Vec(keyx,keyy);
#endif
	int a=read(),b=read();
	if(a==x&&b==y) exit(0);
	return Vec(a,b);
}
db Area(vector<Vec> v) // ccw
{
	db ans=0;
	for(int i=1;i+1<(int)v.size();i++) ans+=cross(v[i]-v[0],v[i+1]-v[0]);
	return ans/2;
}
Vec centroid(Vec A, Vec B, Vec C)
{
	return (A+B+C)/3;
}
vector<Vec> chkok(vector<Vec> hull,int lim)
{
	db S=Area(hull);
	if(S>lim) return {};
	int L=N,R=0,U=0,D=N;
	for(auto [x,y]:hull) L=min(L,(int)floor(x)),R=max(R,(int)ceil(x)),U=max(U,(int)ceil(y)),D=min(D,(int)floor(y));
	vector<Vec> ans;
	for(int i=L;i<=R;i++) for(int j=D;j<=U;j++)
	{
		Vec v(i,j);
		int ok=1;
		for(auto seg:a) ok&=ccw(seg.s,seg.t,v)==1;
		if(ok) ans.push_back(v);
	}
	if((int)ans.size()<=lim) return ans;
	else return {};
}
signed main()
{
	N=read();
#ifdef wasa855
	cin>>keyx>>keyy;
#endif
	a.emplace_back(Vec(0,0),Vec(N+1,0));
	a.emplace_back(Vec(N+1,0),Vec(N+1,N+1));
	a.emplace_back(Vec(N+1,N+1),Vec(0,N+1));
	a.emplace_back(Vec(0,N+1),Vec(0,0));
	for(int i=1;i<=L;i++)
	{
		vector<Vec> hull=halfPlane(a);
		vector<Vec> vok=chkok(hull,L-i);
		// printf("%Lf\n",Area(hull));
		// for(auto i:hull) print(i);
		// printf("----------------------\n");
		if(vok.empty())
		{
			Vec c(0,0); db siz=0;
			for(int j=1;j+1<(int)hull.size();j++)
			{
				db s=cross(hull[j]-hull[0],hull[j+1]-hull[0]);
				// printf("%Lf\n",s);
				c=c+centroid(hull[0],hull[j],hull[j+1])*s;
				siz+=s;
			}
			c=c/siz;
			int X=round(c.x),Y=round(c.y);
			// printf("+++ %Lf %d %Lf %d\n",c.x,X,c.y,Y);
			Vec R(X,Y); Vec Q=query(X,Y);
			Vec d=r90(Q-R);
			Seg s(R+d,R-d);
			a.push_back(s);
		}
		else
		{
			shuffle(vok.begin(),vok.end(),rnd);
			for(auto [x,y]:vok)
			{
				query(x,y);
			}
		}
	}
	return 0;
}



Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
1 1

output:

1 1

result:

ok guessed correctly in 1 attempt

Test #2:

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

input:

2
2 2
1 1
1 1
1 2

output:

1 1
2 1
2 2
1 2

result:

ok guessed correctly in 4 attempts

Test #3:

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

input:

2
2 2

output:

2 2

result:

ok guessed correctly in 1 attempt

Test #4:

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

input:

2
2 1
2 1
1 2
1 1

output:

1 2
2 2
2 1
1 1

result:

ok guessed correctly in 4 attempts

Test #5:

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

input:

2
2 1

output:

2 1

result:

ok guessed correctly in 1 attempt

Test #6:

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

input:

4
2 1
2 4
3 4
1 4
1 2
3 2
2 1
1 4

output:

4 4
3 2
3 3
2 3
2 4
4 1
4 3
1 4

result:

ok guessed correctly in 8 attempts

Test #7:

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

input:

8
5 6
7 4
3 3
1 8
3 5
2 7
8 3
6 8
8 2
2 5
2 7
3 7
5 8
6 7
4 6
8 7
5 7
8 1
1 4
5 8
2 3
8 7
6 8
4 5
2 2
4 7
8 8
7 6
2 1
8 1
7 6
8 8
2 8
2 7
3 6
4 5
4 7
4 5
6 6
3 3
8 1
4 7
6 7
4 5
4 1
8 7
5 5
4 7
4 7
3 6
7 3
3 7
8 7

output:

7 4
3 6
2 6
3 4
1 8
6 1
6 3
5 6
6 7
8 2
7 2
2 3
5 1
8 4
3 7
7 5
8 6
4 2
1 1
4 3
7 1
5 7
4 7
2 5
3 1
3 5
6 5
2 1
1 7
7 8
6 6
4 1
5 2
6 4
3 2
8 1
6 2
3 3
4 6
1 3
1 4
1 6
3 8
5 3
5 8
7 3
2 7
2 8
5 4
1 2
4 4
8 5
8 7

result:

ok guessed correctly in 53 attempts

Test #8:

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

input:

15
9 6
13 2
13 4
9 9
14 9
7 9
4 13
5 10
12 3
5 10
8 8
7 14
13 3
14 8
7 8
11 6
11 7
9 7
12 14
8 13
6 13
14 7
11 14
13 4
14 6
2 15
10 14
3 7
11 9
14 13
8 6
13 9
1 7
6 4
14 2
14 9
8 2
1 6
6 14
1 10
5 11
8 14
11 10
3 5
13 8

output:

8 8
9 4
15 8
10 3
13 3
13 5
14 8
15 9
15 10
15 11
15 2
14 5
14 3
13 7
15 1
11 2
15 4
11 4
13 6
10 4
11 3
11 5
10 5
9 2
11 7
9 3
12 6
14 6
14 2
12 4
15 6
12 9
14 10
14 4
8 1
12 8
13 9
15 5
12 5
15 3
11 1
9 1
14 1
15 7
13 8

result:

ok guessed correctly in 45 attempts

Test #9:

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

input:

30
27 16
6 11
23 23
22 4
23 13
9 29
28 19
27 20
26 5
26 5
5 6
30 26
26 13
30 6
26 13
25 4
26 3
23 3
29 23
19 22
29 22
28 17
23 30
30 13
22 1
9 19
28 30
19 16
29 25
28 18
26 14
28 21
24 19
13 28
28 22
23 30
26 11
21 14
23 17

output:

16 16
24 16
20 13
20 21
17 15
21 15
17 16
21 21
18 18
18 14
25 12
20 17
21 14
20 14
21 18
22 20
19 18
18 16
19 15
24 13
18 17
22 21
23 14
19 17
18 20
23 15
20 16
21 13
17 17
19 16
22 14
24 15
17 14
22 16
22 13
22 17
19 19
23 13
23 17

result:

ok guessed correctly in 39 attempts

Test #10:

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

input:

60
26 42
8 51
29 53
10 53
7 35
59 52
9 42
18 60
4 59
17 57
3 58
33 59
4 49
6 53
18 54
30 59
1 46
12 59
19 59
21 56
12 60
32 55
7 53
25 60
30 59
6 46
1 51
9 46
24 55
9 37
4 59
8 57
20 55
14 51
6 56
31 54
1 52
12 54

output:

31 31
26 45
12 43
18 50
13 54
12 50
17 52
17 51
13 51
15 52
15 49
13 47
14 52
15 48
17 49
13 49
17 50
13 52
14 49
15 43
15 47
13 48
14 47
12 53
14 50
14 45
15 44
15 51
16 46
18 51
16 52
14 43
16 47
14 46
13 53
15 45
17 48
12 54

result:

ok guessed correctly in 38 attempts

Test #11:

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

input:

120
61 21
89 72
78 85
8 79
102 43
95 3
3 95
6 9
72 8
96 85
36 58
63 23
40 56
82 94
23 20
53 44
8 62
116 29
80 20
106 108
119 76
1 80
12 26
68 20
4 47
33 60
57 37

output:

61 61
60 31
86 38
75 50
54 51
64 48
65 43
61 43
62 40
54 39
60 39
59 42
60 40
57 35
56 42
60 38
60 43
57 40
59 44
55 36
53 40
58 35
58 41
55 38
62 41
59 36
57 37

result:

ok guessed correctly in 27 attempts

Test #12:

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

input:

239
70 77
5 5
104 222
119 58
226 63
163 73
178 2
182 10
121 13
11 38
134 67
69 59
133 36
130 185
45 99
73 1
33 29
76 225
116 85
92 125
82 25
65 169
24 109
67 97
52 227
33 76
51 186
46 136
90 7
43 51
27 156
44 77
12 28
105 118
2 140
139 142
156 226
7 146
43 165
42 130
78 12
169 18
140 203
103 146
42 ...

output:

120 120
75 86
58 50
48 81
79 62
100 51
114 45
123 38
130 34
127 33
138 29
131 32
136 30
135 31
126 35
123 36
123 34
142 28
123 33
141 28
130 31
139 30
129 33
135 30
128 33
137 30
127 34
130 32
122 34
126 34
136 31
124 35
124 34
130 33
128 34
133 32
139 29
125 36
124 33
126 33
129 32
122 35
126 32
13...

result:

ok guessed correctly in 52 attempts

Test #13:

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

input:

477
137 90
4 290
149 261
120 148
82 19
165 351
36 422
45 455
81 411
21 279
49 164
2 149
335 472
107 390
436 450
28 428
87 341
133 324
74 271
87 368
47 286
51 288
154 77
9 285
21 350
53 468
5 474
41 72
184 431
126 397
145 464
144 443
175 471
94 241
37 446
389 154
49 398
19 220
132 446
6 222
163 475
3...

output:

239 239
184 138
89 192
113 255
153 209
135 188
117 209
78 223
61 234
53 240
41 244
45 241
41 240
48 236
43 238
46 238
44 238
47 236
45 238
43 239
46 239
47 238
40 243
50 238
44 241
42 241
49 237
42 242
41 241
42 239
43 240
42 240
45 239
40 242
49 239
39 243
45 237
47 239
49 238
45 240
47 237
44 237
...

result:

ok guessed correctly in 52 attempts

Test #14:

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

input:

954
563 67
272 104
723 206
464 28
715 821
366 774
2 742
260 40
517 101
190 66
40 47
634 4
115 614
881 411
252 34
852 72
254 469
335 509
658 25
319 27
297 1
160 544
92 116
118 291
657 237
717 74
548 785
385 13
642 106
783 99
749 199
125 855
751 17
35 117
285 170
923 76
155 116
541 69
834 57
48 44
109...

output:

478 478
510 242
274 194
409 186
447 88
484 129
446 160
403 162
366 145
387 143
377 136
371 131
375 123
373 128
376 131
375 128
378 125
377 125
376 130
374 130
373 133
379 127
376 129
376 126
374 127
372 130
376 124
377 127
373 131
375 127
372 131
379 126
374 133
377 129
378 128
373 130
378 127
376 1...

result:

ok guessed correctly in 45 attempts

Test #15:

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

input:

1908
1309 661
1848 1124
1005 838
824 240
1495 258
416 1624
721 151
913 142
1813 261
1433 285
1307 114
1878 408
1835 196
1740 227
670 759
1744 579
553 626
604 92
1114 34
885 516
64 670
1675 15
1826 100
1705 23
1882 66
964 521
1146 28
1640 717
674 510
323 215
1405 210
872 634
1510 79
1529 25
289 731
2...

output:

955 955
1322 690
1612 1027
1476 843
1492 644
1677 404
1589 528
1526 522
1495 520
1551 445
1572 407
1583 386
1604 365
1613 355
1617 350
1613 350
1618 355
1615 355
1619 355
1619 359
1619 357
1613 351
1616 355
1611 353
1611 352
1619 360
1619 358
1615 349
1617 353
1619 356
1614 353
1620 358
1613 352
161...

result:

ok guessed correctly in 51 attempts

Test #16:

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

input:

3815
3677 2978
2089 3746
1619 2675
211 3109
3751 3137
790 3711
1856 1278
3724 3051
665 3513
2726 3092
3022 3213
1985 3392
1106 3511
95 2215
3764 3703
621 3591
263 3401
2891 3652
3638 3443
1587 3480
983 3809
2627 3505
972 3672
1713 3804
3799 3746
2921 3760
112 3657
1216 3722
1690 3714
1705 433
471 32...

output:

1908 1908
2746 2293
2418 3094
1847 2979
1482 3251
1677 3107
1661 3436
1620 3221
1716 3295
1666 3262
1688 3269
1708 3338
1718 3392
1709 3405
1706 3386
1710 3388
1707 3397
1705 3401
1705 3405
1706 3398
1706 3397
1704 3406
1705 3403
1706 3400
1704 3408
1706 3406
1707 3402
1706 3404
1705 3404
1703 3413
...

result:

ok guessed correctly in 33 attempts

Test #17:

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

input:

7630
3987 5472
6744 2429
869 5964
5741 6102
6949 7586
6721 6955
2558 6848
5914 7493
155 1156
7430 3658
3121 7087
5824 7107
6756 6692
4118 7109
7391 6435
5518 7129
341 7106
6204 7213
6864 6737
386 7624
6507 6530
6983 7452
6727 7244
2454 7536
5493 6777

output:

3816 3816
3947 5717
5649 5271
4439 5031
5102 5643
5369 6258
5597 6591
5438 6603
5466 6811
5410 6723
5493 6657
5439 6679
5467 6713
5486 6714
5480 6730
5487 6735
5492 6758
5488 6754
5489 6764
5491 6764
5490 6768
5490 6767
5492 6773
5489 6761
5493 6777

result:

ok guessed correctly in 25 attempts

Test #18:

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

input:

15259
8394 10191
8991 13478
13662 14961
13531 14017
14228 14933
2585 6838
7597 5354
14734 10613
14235 15209
13989 7027
6514 10711
14884 14874
4615 15190
14990 13415
14317 15059
4372 13774
14624 14830
12953 14490
15074 13594
15053 11526
15036 13888
14829 14877
15124 14954
13780 2469
14629 11668
14875...

output:

7630 7630
8389 11332
9095 13197
12350 12819
13465 13490
13546 14354
12521 14484
12401 14283
13336 13781
13453 13835
13849 13584
13642 13697
13722 13698
13653 13772
13692 13749
13699 13795
13681 13799
13685 13823
13681 13834
13688 13838
13688 13832
13693 13836
13695 13838
13696 13840
13693 13840
1369...

result:

ok guessed correctly in 29 attempts

Test #19:

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

input:

30518
28246 24913
28261 16288
3134 2760
25020 15695
27096 12754
22312 2434
26615 10777
27631 7312
28637 18143
28697 1700
28739 20884
30001 17720
29485 12933
26118 6185
27801 2895
29941 12368
26736 16208
24468 838
27134 6325
25907 2344
29158 10999
9923 23047
23256 5286
26731 4062
30354 1518
20047 958...

output:

15260 15260
21484 19041
26083 14727
24755 9435
23138 13585
25126 12408
25273 10811
26746 10578
27094 9948
27438 10273
27783 10049
27836 10179
28128 10219
28255 10252
28230 10213
28365 10139
28414 10133
28364 10169
28361 10158
28377 10144
28380 10138
28392 10135
28385 10138
28384 10139
28379 10139
28...

result:

ok guessed correctly in 61 attempts

Test #20:

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

input:

61036
30648 41099
24994 8350
4729 58523
4578 55473
18340 22630
8411 34504
13492 56237
2646 53745
6774 29647
3890 34693
2488 22930
2500 47104
4733 53671
4803 11708
2565 23484
1033 26099
573 43995
2891 30889
2656 44913
1691 54404
2921 17566
2126 54107
203 35289
603 15756
3993 58702
40441 28498
1625 48...

output:

30519 30519
30643 45777
27699 38387
13484 40092
8273 43114
10193 41007
5069 38044
7345 39609
5857 40337
5341 39731
3924 39434
3969 39127
3269 39310
3347 39400
4003 39328
3779 39303
3413 39326
3179 39354
3163 39338
3017 39350
2908 39357
2949 39352
2913 39354
2876 39354
2865 39353
2856 39354
2877 3935...

result:

ok guessed correctly in 39 attempts

Test #21:

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

input:

122071
53132 117856
101364 30755
106060 110199
12662 28922
93748 91254
95332 100192
108109 116666
16930 13712
4441 55812
71885 48406
94081 115054
4287 20294
116176 84788
46603 92863
105147 121722
116418 90421
53641 104681
65862 120801
85893 116064
108966 96799
99879 117446
45661 106171
109259 113122...

output:

61036 61036
58206 91357
81618 84887
101811 95214
93873 88139
86776 97528
93063 98235
93125 102043
94074 99307
88813 103663
91027 101178
89736 102537
88245 102945
89230 102274
88720 102511
88790 102887
88976 102647
88873 102753
88866 102902
88931 103060
88963 103052
88982 103138
88967 103121
88975 10...

result:

ok guessed correctly in 47 attempts

Test #22:

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

input:

244141
92644 71279
114263 64041
215629 126925
57201 4986
131753 1737
229296 44617
184236 68273
221092 199254
139549 19370
236255 150104
222868 14247
227114 68804
107166 770
231019 110984
211163 45850
162953 21125
175034 95879
241094 132631
239725 137121
232630 9221
141807 218923
81801 81867
202915 6...

output:

122071 122071
98497 67865
159664 46667
178433 61640
145185 79568
157296 60654
172968 51441
170720 61776
168344 68351
167858 65643
170967 65095
174864 62405
176870 61364
176347 60899
176634 61137
177627 60028
178072 59478
177731 59785
177978 59753
178127 59730
178265 59636
178209 59698
178165 59703
1...

result:

ok guessed correctly in 46 attempts

Test #23:

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

input:

488282
93798 474884
275239 100583
201738 155104
338443 427924
168806 163860
331766 469752
223202 218969
413054 178173
23964 273917
95718 92372
166423 257476
156714 117357
302500 323670
317532 144832
106769 107920
141670 225586
162927 64578
70322 379989
323172 452132
179190 165238
208470 459853
82986...

output:

244142 244142
191117 348938
193506 280448
103928 213674
167344 244946
154415 221737
183824 231137
203590 230436
218263 235771
210414 232831
207518 226399
205675 228517
203926 224524
204999 226589
205866 225926
205145 224982
204653 224958
204574 224426
204301 224714
204439 224848
204350 224791
204136...

result:

ok guessed correctly in 56 attempts

Test #24:

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

input:

976563
670084 117171
628709 48281
764906 344912
930767 801038
129874 161618
918018 16521
51450 22045
903611 559526
909712 138800
527038 68998
569513 20455
820605 320281
621019 7887
746903 22609
677984 502539
817360 955817
365395 285841
789527 26709
455259 611197
277968 388992
916424 115196
199581 50...

output:

488282 488282
568016 263671
581125 133682
787808 175884
815877 251489
708990 246827
764781 235093
731539 221972
741688 240687
754012 228808
749415 222141
747141 218681
749467 219464
754912 214318
762375 208972
758814 211767
757274 213050
755833 213417
756345 212864
755981 213119
755517 213048
755728...

result:

ok guessed correctly in 60 attempts

Test #25:

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

input:

1953125
718546 34788
1194093 1870054
980144 1721279
435224 1594068
30914 1009612
525976 78898
1095299 1407639
537677 1690291
268178 91704
87396 512380
28598 870018
72480 1233676
98437 1352774
58281 887541
73148 120181
165120 1495046
3738 1202668
30492 402769
84856 967805
214752 120410
433585 1641812...

output:

976563 976563
887380 500498
944508 736525
663175 904564
317320 982805
152437 988436
170100 884509
241155 917869
247322 973543
244481 945571
226565 937147
182642 952484
161396 961345
151118 965825
138387 964885
139470 961970
138740 963439
131740 963984
130235 963379
127560 963718
128159 963159
129145...

result:

ok guessed correctly in 63 attempts

Test #26:

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

input:

3906250
1158174 2062772
1260908 679315
610050 3548370
174786 2410307
293289 510892
1521861 376108
223824 101035
3013581 3083721
268885 1789936
297924 45889
375961 3485144
322043 1061849
163496 3182954
1176435 1101285
220936 1016733
467516 655141
241158 1529595
406287 221145
32312 983229
257408 75416...

output:

1953126 1953126
982756 2042922
949536 1052145
981527 1556791
569804 1589511
328730 1340319
462638 1266964
316122 1112537
414215 1177957
388647 1226461
359953 1199866
369896 1214161
305126 1215125
282877 1223694
308636 1223195
296691 1221165
301720 1218027
298070 1219261
294454 1217699
287913 1216652...

result:

ok guessed correctly in 76 attempts

Test #27:

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

input:

7812500
4940148 3839991
5283134 2286639
1639950 850522
4502401 6738094
6179712 2094758
7216989 3962204
5325790 3310401
1775130 6046971
3854207 1342480
3098272 3702126
3210690 4210654
4446501 433823
4018848 1989771
2637827 3606026
4427265 4658026
6679095 2441222
269287 7557436
5028020 794980
7208697 ...

output:

3906251 3906251
5856702 3822803
5675984 1912010
4724434 1883682
4599939 2999855
4917758 2573219
5160222 2827956
5072087 3229112
4978855 3382087
4863937 3190000
4786171 3178889
4779354 3236861
4716967 3132654
4682935 3077943
4665334 3074236
4674738 3105427
4683259 3108875
4687651 3126453
4684216 3116...

result:

ok guessed correctly in 49 attempts

Test #28:

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

input:

15625000
1097234 12279512
8077934 6948981
771451 14016339
3712324 8440210
7873869 2096802
1337217 3643993
4201927 1289022
12330103 10849398
319738 5408328
986021 13891968
63855 11066794
2772593 2730123
1256924 217869
3162498 424781
3037641 937937
313955 4609639
10638313 10650161
1352618 3601019
2892...

output:

7812501 7812501
4482415 9544798
5713044 7943904
7411672 11160948
4902386 8540268
3854847 7053020
2425449 5871190
1790236 5070147
2431187 5599131
2051446 5388893
2056967 5557800
2007731 5624814
1934790 5560577
1752057 5500347
1773586 5481046
1758029 5463444
1674920 5436908
1714892 5449687
1697584 544...

result:

ok guessed correctly in 46 attempts

Test #29:

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

input:

31250000
15163801 8278166
3933736 14860487
26670854 17175966
16697424 23175149
9662249 6030989
29076607 4553945
10939895 27684033
28226774 20003660
1837159 21540041
9979681 8118150
195267 10988102
6032382 3861704
27415428 15166467
24445525 17931116
12487754 8322289
27881863 17966381
1876806 17847991...

output:

15625000 15625000
15298046 7822762
7790489 8847138
11877015 10948587
12569849 13503944
11034183 12741981
13965028 11557750
12806349 12305912
13922257 12371949
13209195 12658924
13118156 12328329
12862704 12521417
12971422 12188495
13070687 12058510
13052215 12224129
13091669 12107698
13111274 121256...

result:

ok guessed correctly in 57 attempts

Test #30:

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

input:

62500000
51943776 46352566
55651698 58937276
37772784 54123673
60454684 48698975
49350261 61547110
56477405 58252953
53841780 58619279
3767850 43489482
45659872 59186063
39771468 62221988
10204601 61890277
56895745 61490400
4014071 59661058
42771479 62198149
58293358 62105940
33938042 62445868
46100...

output:

31250000 31250000
44100909 38852209
43171716 50948869
31066247 55611033
38133802 54241797
41506144 57871466
44365851 57841346
46221253 59525053
45258231 58424183
45182688 60099127
44702023 60918251
44409396 60890620
44554697 60963348
44488123 60771268
44451306 61659976
44491619 61654392
44473182 620...

result:

ok guessed correctly in 66 attempts

Test #31:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

125000000
67187719 102767800
65172004 113110069
53273813 113970598
4282519 108834577
122033350 86527795
112773264 117690546
2301543 105376098
29438744 118774512
26827810 122205839
29708675 105863905
13653493 99663283
23075738 115903887
8735782 112654259
19502532 119048506
79627419 124107464
413398 1...

output:

62500001 62500001
64925283 93608833
63025292 109316436
31802693 110140846
15953852 109494182
23805627 108251435
27708282 110104954
25967586 107999215
24839959 115953767
24213055 120306683
24652663 118085876
24516151 117124936
23769927 117191216
23248603 117535436
23021486 118100458
23186020 11815515...

result:

ok guessed correctly in 71 attempts

Test #32:

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

input:

250000000
78273938 150852172
199961094 67106820
39197263 3989303
207257606 233862786
148799097 213589741
26661429 183877120
56060373 26330500
137071279 61295431
58802542 33377581
131241059 114470774
128894321 56443559
49519563 128614815
145069395 37894151
23092383 88804817
15507336 11891856
87249466...

output:

125000001 125000001
68877265 148052955
89302753 122834144
53803389 62884846
72692609 91706008
81421522 107017144
68690132 115455281
64742360 108562337
72113715 106864095
67919501 102705036
71709212 103787980
73330580 102992816
72390010 103215764
73017027 103260712
71184420 101427282
70072996 1002812...

result:

ok guessed correctly in 65 attempts

Test #33:

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

input:

500000000
489219677 92646608
110539880 289561968
313287941 106898846
44648760 139898006
2817209 49860667
359638110 13361463
112502380 42017333
31660776 385172737
72531948 69974018
61597960 72878864
177643354 43443910
82785958 26215728
12203333 32906805
41618988 35983319
311841170 59956034
221905091 ...

output:

250000001 250000001
356972016 195185183
290700831 205260235
236098481 96985731
185713026 80814440
153680267 45881464
172659059 50628913
163444439 37060385
163198962 61605428
160010228 65069563
157511681 58169406
156009469 45150778
154804888 39690998
153659000 38794622
152960271 36922934
153309139 38...

result:

ok guessed correctly in 73 attempts

Test #34:

score: 0
Accepted
time: 3ms
memory: 3712kb

input:

999999995
731743801 677141913
678887807 289944252
991436166 584343560
374619759 414967312
608566258 925743108
837988316 447683261
702535352 924590100
940561203 398450397
444096198 363946932
870315297 362988326
969008524 22415410
994035467 670412456
447635741 826082151
134852056 362504159
859210468 6...

output:

499999998 499999998
701309393 627397805
788866430 384172953
845928601 472107835
743989869 521096076
703269909 578656095
751675051 564492304
767102214 590714192
795881092 589966370
775996362 580422644
779159256 574471645
785835093 572740882
795638266 575008280
791444001 575234820
788781413 573674434
...

result:

ok guessed correctly in 74 attempts

Test #35:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

999999996
171715764 979074195
206437356 227725766
935178208 643702300
596904306 782655152
129635531 330029861
580728254 685216425
598558417 650218939
108939290 931230581
553878792 790834835
973264297 624074984
393542561 790023882
488119468 204609878
197865222 922478761
492328033 852813511
26594100 3...

output:

499999999 499999999
385792138 710869691
219822527 540245415
364726247 574627029
429807572 623353749
370720203 624711557
434011643 568338332
462965468 558664320
435905610 596078575
426897229 616103575
445970354 598426948
435979273 607615317
438691708 602523714
434618619 604103130
437147080 606021529
...

result:

ok guessed correctly in 55 attempts

Test #36:

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

input:

999999997
498799184 167352766
573749365 332069018
441082212 126179463
788486790 36210881
396755392 52192630
947558034 216883585
944114783 25186939
729705354 48854052
907705983 149907372
411906365 80387318
851503606 28278547
975217713 98916749
539432226 5024822
484235442 13172566
969136693 42664393
2...

output:

499999999 499999999
499398353 250001085
723924346 295682164
589521398 291923451
707687646 169490570
643668923 191723343
683838957 161766434
708298191 101623884
725600072 68172368
738055128 63844378
728095256 83869761
732937174 72488709
735502393 75090759
735427076 64498410
735351510 58645859
7362740...

result:

ok guessed correctly in 62 attempts

Test #37:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

999999998
455927032 299419738
241943164 441832667
686845488 209388709
126004774 343664098
253834622 816838184
847585407 43669793
181746003 300951579
66309136 681675661
130367020 233476048
194649420 201608490
662340154 892083730
259424584 301174130
192145536 1817658
143794347 152379512
952493180 9360...

output:

500000000 500000000
463378776 254023342
233824067 313018140
362686624 308510118
286365285 264196593
313104126 395759722
324863669 349067124
295537271 306797944
289655971 328487089
269089323 306616918
255694887 292178452
263375383 299498374
258133043 301760686
256274514 297354083
254674742 295646468
...

result:

ok guessed correctly in 59 attempts

Test #38:

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

input:

999999999
752461264 62849627
941401050 300949134
163111927 614856593
188097688 571275657
387953012 268296601
357591723 143059402
983413772 343023151
519558388 11827208
586349303 79654018
829168647 712079674
997961027 450763563
864178901 210307448
554787886 167976650
93985526 4168402
547114220 647087...

output:

500000000 500000000
596252640 277793712
809759462 342915004
734047552 417779872
666850463 405911096
633203240 300588218
627848387 197706798
632646975 249071871
644834334 207978261
648179159 183021098
646201313 196415451
656570054 194031873
662905772 189905790
660065503 189214574
659170472 186427239
...

result:

ok guessed correctly in 65 attempts

Test #39:

score: 0
Accepted
time: 2ms
memory: 3840kb

input:

1000000000
817727855 956297383
210385706 426277621
159857241 859591985
147181496 135771771
204705607 955937797
126967306 655646006
69521199 900837878
403793231 448807321
122186219 870099428
157500028 950391294
42775280 688334143
22411763 982112303
385434426 209169461
494650131 93045859
15440817 8336...

output:

500000001 500000001
616052918 709595162
432913297 699529857
264399108 844089869
269772463 763151413
184291470 812555855
138378940 798148747
78133972 826817762
108977792 811301608
118460409 822130845
125184654 826959403
110322785 829582214
100113005 834099230
104497794 831673246
107256395 830596077
1...

result:

ok guessed correctly in 77 attempts

Test #40:

score: 0
Accepted
time: 2ms
memory: 3584kb

input:

1000000000
952213223 676158930
534823457 732908347
969972520 752535356
12065215 677109730
560228949 900118301
55740092 163307346
498602568 864287364
937975359 592779602
928212893 981636310
713832298 919038915
938812571 829402946
297326466 213853789
968660677 975727274
986926843 515131892
537652295 8...

output:

500000001 500000001
737354339 564924731
645293218 779062117
780880895 798692969
705103510 733653343
704191792 855252616
687964308 789012579
667634718 803228519
666505937 767167026
681517956 801685728
692067392 821995889
699562917 831260680
696033870 821886479
697330177 827182151
699207691 824378835
...

result:

ok guessed correctly in 69 attempts

Test #41:

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

input:

1000000000
152810847 163552024
491117230 814029229
168011996 641437624
47475311 642973285
249809856 906910759
159600746 892991093
830304030 467913317
213967924 984678456
41447644 964099139
94599420 313030965
17874732 138256035
31684872 845503330
129010776 946161064
44996564 911571246
8363015 6415322...

output:

500000001 500000001
328256839 338489590
273333229 545454420
129316278 665885687
68310818 645741484
53440557 783122060
41816220 870103253
63263510 817982281
62158343 848587846
55781205 867671600
54026794 856740618
50889278 851630487
41310415 850803828
44911240 852540940
43124166 855041788
42901416 85...

result:

ok guessed correctly in 59 attempts

Test #42:

score: 0
Accepted
time: 3ms
memory: 3712kb

input:

1000000000
218511131 404179658
153768704 104137818
333021385 588351342
2512112 72194050
242479033 60232208
315569128 239971947
269851634 887112698
369084203 68370488
62401453 944532472
134290039 571281809
105438481 384304939
283305698 440197928
9458746 900300221
252216724 92721319
128063812 67895938...

output:

500000001 500000001
259656323 443265760
283985251 213600825
267883501 327067637
136620614 338887741
189110009 277772610
261235251 268334369
243694844 304630687
259401851 285985956
245939268 292977241
241759462 297175828
218615025 286956606
231268955 293445921
232802940 296616810
226744013 293250109
...

result:

ok guessed correctly in 59 attempts

Test #43:

score: 0
Accepted
time: 3ms
memory: 3712kb

input:

1000000000
654942201 56916550
171434147 661911417
713549037 386632121
47383598 600784624
821455188 16574985
69457926 308642218
86631277 138000736
728823832 149743128
103754673 351320545
693391685 84087552
64697555 401504815
156493610 92303333
83613049 279992174
346882644 101385689
597398633 66728732...

output:

500000001 500000001
558281798 260190304
363637457 290525424
572190936 408393549
460561522 354192144
476526562 292176447
433287683 240724076
413756346 210685144
426798769 182219526
422052147 203883574
422305245 188380277
424486414 200229467
416087316 183720606
411666532 176458567
408521247 168741874
...

result:

ok guessed correctly in 67 attempts

Test #44:

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

input:

1000000000
497027630 888283747
989744386 948894520
303037598 973227575
569634892 767218539
267143854 617322972
584305646 969451351
298957512 936226166
512326939 134124373
261129614 939746915
50306419 928105918
941689680 974475120
355979590 951457436
682887365 746247880
377503095 479529190
93008271 7...

output:

500000001 500000001
498724142 749995118
745589123 767811909
620265589 825947518
575728050 745030671
535223511 747377567
488937406 861654793
457911163 918421277
471272124 884844082
457440035 893541013
448442919 898077613
453163801 898347574
452252838 908689138
453545994 905047318
451299848 900394290
...

result:

ok guessed correctly in 60 attempts

Test #45:

score: 0
Accepted
time: 2ms
memory: 3840kb

input:

1000000000
928724867 28551128
885983926 781982383
424165719 949351048
950357345 680904279
954796503 896021523
203986206 29699737
932475668 737577478
517485738 660216217
551618224 993055844
910215115 764406547
835114409 880189662
979743174 590540121
977924028 995384855
823743690 959497493
983108396 8...

output:

500000001 500000001
651562871 318913911
808759782 510057293
759000246 609187828
880299258 716260567
927371436 792898647
901014568 753010181
945638086 727550586
921741983 736363750
913986444 750551709
922031461 768972247
920638751 777181717
917356684 769885109
923172745 774922806
920271992 775372795
...

result:

ok guessed correctly in 57 attempts

Test #46:

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

input:

1000000000
40153281 873223555
553354824 118384943
233934183 618563356
276415203 89788964
145227749 970491893
103579159 318363882
272136462 705917585
19428626 350855818
13813676 763947926
70831232 439845469
369492622 36805420
126161538 199188628
135474941 747705482
96409635 13585489
42348523 39041795...

output:

500000001 500000001
304894731 635271001
273719988 426530383
367325431 573719576
237020463 491172866
224201199 527353982
124448727 502363937
173366649 517419018
146194912 512928381
127586678 527456040
117151412 521321969
127039626 514571587
127273434 510319535
128202127 512578177
125364762 511622334
...

result:

ok guessed correctly in 65 attempts

Test #47:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

1000000000
353937247 314764982
168514016 546282350
81359510 249510576
825695096 451812814
161198468 360181666
221395649 159750461
966124752 75529860
283001720 18689199
124167690 181228496
308210994 31268707
751269624 765232826
157859213 131113774
76488396 945670106
39972307 222120534
121060790 44877...

output:

500000001 500000001
368578888 301814527
185467830 449989567
136088098 293591823
222729497 324958624
171258590 371538129
179440092 320165456
199754665 318546849
181022993 276167955
168464096 250596761
164482543 236106359
171171245 245708209
167501195 240818062
166786769 243434449
162963670 243289188
...

result:

ok guessed correctly in 71 attempts

Test #48:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

1000000000
320237317 15520840
954581447 752790654
912880191 10707207
679142575 325007422
454961447 178474322
695348150 171673357
420158144 250809418
374471466 324513112
443077890 264507257
450872397 14820332
604745231 79382768
708344829 313559382
546227281 464181678
903968154 19793865
478806150 1677...

output:

500000001 500000001
438159472 261472753
641577058 283523455
800418042 178160738
734238151 237578205
655932722 185561284
690936136 171503396
673309725 179116170
680725811 223474661
657420803 170699016
642271213 129425701
632091315 104700395
637423396 117663970
639292438 123818438
642196987 123272037
...

result:

ok guessed correctly in 73 attempts

Test #49:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

1000000000
34594522 889589819
840450570 978002750
297824028 266936883
263951574 251109538
999792339 365879131
548999781 3140362
799343486 382722163
768805049 338929306
762035869 464751576
799713824 629529444
323140961 826380386
818220461 386745133
539726903 225526615
5252454 722555394
864670952 3834...

output:

500000001 500000001
308394369 639516270
479724090 810063901
421324379 698738494
426512726 609770668
482727111 571818735
462438306 521461248
490778077 521059061
503558691 519951530
528462592 550858845
540931273 565278722
536630249 570185052
542273547 570578406
536501775 564546384
533190308 562182419
...

result:

ok guessed correctly in 61 attempts

Test #50:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

1000000000
170796070 633148269
366447636 549575318
191336129 473825834
636061293 224222911
336281695 73109611
346750418 34826853
968573862 31527155
413874217 28629478
77038749 61242636
27432605 87782722
202885978 39642644
668281806 21841894
256160675 6052807
281771071 8619632
42169466 66454806
24997...

output:

500000001 500000001
263632007 567409214
398393299 577602106
312119735 339579855
340817020 262652573
295230831 133745667
276201061 69438548
307997429 86770834
314100870 72356413
296208145 37045164
286933299 29404623
280681553 20997096
284023526 26676313
282777673 15559062
282525339 8462861
281868665 ...

result:

ok guessed correctly in 71 attempts

Extra Test:

score: 0
Extra Test Passed