QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#804130#9869. Horizon Scanningucup-team1338#TL 937ms22480kbC++201.8kb2024-12-07 20:34:112024-12-07 20:34:13

Judging History

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

  • [2024-12-07 20:34:13]
  • 评测
  • 测评结果:TL
  • 用时:937ms
  • 内存:22480kb
  • [2024-12-07 20:34:11]
  • 提交

answer

#include<bits/stdc++.h>
#define LL long long
#define len(G) (LL)(G).size()
#define all(G) (G).begin(),(G).end()
#define ar(n) array<LL,n>
using namespace std;
using i128=__int128;
using ar=array<LL,2>;
using Poly=vector<LL>;

mt19937_64 rnd(random_device{}());

constexpr LL N=2e5+9;
constexpr double eps=1e-10;
using numbers::pi;

LL n,K;
double t[N];

template<class T>
inline void read(T &x)
{
	x=0;int w=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')w=-1;	c=getchar();}
	while(isdigit(c)){x=x*10+(c^'0');	c=getchar();}
	if(w==-1)	x=-x;
}
template<class T,class... Args>
inline void read(T &x,Args &...args)
{
	read(x),read(args...);
}

double ang(double x,double y)
{
	double t=atan2(y,x);
	if(t<0)	t+=2*pi;
	return t;
}

// map<double,LL> mp;
vector<pair<double,LL>> G;
void add(double l,double r)
{
	// ++mp[l-eps];
	// --mp[r+eps];
	G.push_back({l-eps,1});
	G.push_back({r+eps,-1});
}

bool check(double a)
{
	// mp.clear();
	// mp[2*pi+eps]=0;
	G.clear();
	G.push_back({2*pi+eps,0});
	for(LL i=1;i<=n;++i)
	{
		double l=t[i]-a/2,r=t[i]+a/2;
		if(l<0)
		{
			add(0,r);
			add(l+2*pi,2*pi);
		}
		else if(r>2*pi)
		{
			add(0,r-2*pi);
			add(l,2*pi);
		}
		else
		{
			add(l,r);
		}
	}
	sort(all(G));
	// if(mp.begin()->first>0)	return 0;
	// if(G.begin()->first>0)	return 0;
	LL cur=0;
	for(auto [k,v]:G)
	{
		if(k>0&&cur<K)	return 0;
		if(k>2*pi)	break;
		cur+=v;
	}
	return 1;
}

void solve()
{
	read(n,K);
	for(LL i=1;i<=n;++i)
	{
		LL x,y;
		read(x,y);
		t[i]=ang(x,y);
	}
	double l=0,r=2*pi;
	for(LL _=1;_<=30;++_)
	{
		double mid=(l+r)/2;
		if(check(mid))	r=mid;
		else	l=mid;
	}
	printf("%.10lf\n",l);
}

int main()
{
	LL T;
	read(T);
	while(T--)	solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4344kb

input:

5
1 1
0 1
8 2
1 0
1 1
0 1
-1 1
-1 0
-1 -1
0 -1
1 -1
4 2
-1 1
0 1
0 2
1 1
4 2
-1000000000 0
-998244353 1
998244353 1
1000000000 0
3 1
0 1
0 2
0 -1

output:

6.2831853013
1.5707963209
5.4977871379
3.1415926536
3.1415926477

result:

ok 5 numbers

Test #2:

score: 0
Accepted
time: 179ms
memory: 4208kb

input:

10000
16 1
-10 -6
-5 -6
-4 9
-2 5
-2 10
1 -7
1 -5
1 6
3 1
4 -9
6 -10
6 -3
6 1
8 -5
8 -4
9 -4
17 4
-9 2
-8 -4
-8 -3
-8 -1
-6 -2
-6 -1
-6 8
-5 -8
-5 10
-4 8
-2 -8
4 -9
4 0
5 -3
8 -5
9 -2
10 10
10 6
-7 2
-4 6
-2 -7
-2 -1
-1 7
1 -9
1 8
3 -4
7 -4
9 -2
14 3
-9 10
-8 -10
-8 -8
-6 -7
-6 -5
-1 -7
-1 -2
0 -1
...

output:

1.6929914923
2.5748634328
4.6527582627
2.7726331043
5.7427658020
4.8576989889
3.4198923081
2.8127999603
6.2831853013
6.2831853013
5.1172807645
6.1467826967
3.8420890204
2.3424967142
3.4633432045
6.2831853013
5.9614347504
3.3247034705
5.2627749251
5.6724593401
1.6738779293
1.1141908508
2.4087775474
6...

result:

ok 10000 numbers

Test #3:

score: 0
Accepted
time: 180ms
memory: 4232kb

input:

10000
19 7
-10 -6
-10 5
-3 0
-2 -5
-1 1
-1 6
0 3
0 7
1 9
3 -3
3 3
3 8
4 -1
5 8
6 -3
7 -5
7 4
8 10
9 -5
15 15
-9 -1
-8 6
-7 9
-6 -3
-4 -9
-1 -3
-1 8
1 -8
1 -7
3 -2
3 1
6 -9
7 -10
7 0
10 -9
10 3
-7 -1
-6 -2
-6 10
-5 2
-4 2
-3 -7
-2 -9
1 -3
3 4
7 7
15 4
-8 -8
-8 8
-7 0
-7 10
-6 -7
-5 6
-1 -3
-1 0
1 -2
...

output:

3.9269908111
6.2831853013
3.3602615962
2.6779450411
3.7703889359
1.7625844657
3.8402524730
5.4977871379
2.0344439334
1.8157749850
4.3471875272
6.1412882515
5.1760365870
5.4655402571
5.7690391494
4.3662530129
5.9947557467
4.8922424756
4.1719694752
5.6776406390
5.9614347504
3.5067941009
4.5429759336
5...

result:

ok 10000 numbers

Test #4:

score: 0
Accepted
time: 178ms
memory: 4232kb

input:

10000
18 12
-10 -4
-10 7
-8 -10
-7 -4
-6 5
-6 7
-5 0
-2 -7
-1 2
-1 10
0 2
1 1
3 -2
5 3
5 5
6 -3
8 -3
9 -2
10 1
-10 -9
-7 -7
-5 2
-4 -7
-3 1
3 1
3 3
5 -4
9 2
9 6
11 2
-8 1
-8 6
-7 -2
-6 0
-5 0
-1 -9
2 -8
3 5
6 0
10 -2
10 6
20 9
-10 -6
-10 6
-9 -8
-7 5
-6 -4
-4 -8
-2 -10
-2 -3
-2 4
-1 1
2 -5
3 -2
5 -6...

output:

4.9097845369
1.9756881109
1.9868608318
3.9269908111
3.6977588803
6.2831853013
6.1412882515
6.1938713087
5.8053542475
6.2528915448
5.7288778057
3.0900918398
1.8925468777
5.6341897425
2.8966139895
6.2831853013
2.9147938013
6.1476575920
1.9513027002
5.5643553058
5.4977871379
3.0981417571
4.3906384236
3...

result:

ok 10000 numbers

Test #5:

score: 0
Accepted
time: 179ms
memory: 4148kb

input:

10000
19 7
-10 -1
-8 2
-7 -10
-6 6
-4 7
-3 -5
-3 1
-3 8
-2 4
-1 -7
0 -8
0 9
1 -10
2 1
2 3
3 5
6 -4
10 2
10 3
14 10
-8 2
-6 0
-5 -10
-5 10
-4 7
-3 -6
-2 -6
1 4
1 6
2 -1
3 -6
8 -4
9 -10
10 -1
12 8
-9 5
-7 2
-4 2
0 -2
0 5
1 6
3 2
4 9
5 5
7 -6
9 -9
9 2
19 12
-10 -10
-10 2
-9 -6
-8 2
-7 -5
-6 8
-4 1
-1 -...

output:

3.2393195604
5.2757052367
5.3003915814
5.3871299195
5.8883941824
4.1173193557
1.1383885458
1.5152978201
6.1476575920
6.1588303070
2.5748634328
5.9401613644
1.6085142755
4.6099451224
5.0711596447
4.2345579207
3.7905882065
4.0376480354
3.9160022424
1.0636978179
4.2809882488
5.8572556492
3.4078446978
5...

result:

ok 10000 numbers

Test #6:

score: 0
Accepted
time: 179ms
memory: 4040kb

input:

10000
11 10
-10 -1
-9 4
-9 10
-7 -7
-5 4
-4 -1
-2 -10
0 -7
0 5
3 3
3 5
12 12
-9 6
-9 8
-3 -2
-2 2
0 -4
1 0
2 -3
3 5
5 -2
7 -1
10 3
10 9
14 12
-10 0
-9 -3
-9 1
-9 10
-8 -1
-8 7
-6 -1
-1 -6
-1 2
1 -1
3 -7
4 9
9 -3
10 1
10 4
-9 -3
-7 -1
-6 -10
-3 -2
-3 7
2 -2
2 3
5 2
6 9
9 6
10 2
-9 -9
-9 6
-8 3
-5 -9
...

output:

6.1378752928
6.2831853013
6.1180366257
3.2003484761
2.6537562115
6.2537820172
3.6052402602
3.5598169816
1.5091461501
5.9275494189
6.2587998965
2.6224465344
4.3938333021
5.4977871379
4.2487413679
5.4977871379
4.6292477472
3.5464844377
6.0048856469
1.1967518908
2.8854412687
6.2000440740
1.9237867092
5...

result:

ok 10000 numbers

Test #7:

score: 0
Accepted
time: 182ms
memory: 4180kb

input:

10000
14 1
-100 13
-96 -31
-82 -92
-77 -98
-50 1
-14 -57
-14 -31
-11 64
-8 75
9 68
25 100
54 -36
59 13
93 31
19 19
-76 -39
-60 95
-51 18
-39 11
-21 -46
-6 -94
-5 83
-3 -34
-3 72
0 -55
3 79
14 17
23 -88
32 37
50 70
61 -5
62 -43
84 -100
97 -50
13 7
-99 -63
-68 -87
-24 62
-20 -18
-2 -66
7 -49
13 -21
15...

output:

1.2713093936
6.2831853013
5.2225147174
6.0030657007
3.9258721352
5.5465289936
3.2103149215
3.0399300465
4.2275317768
3.0320196623
2.1912152321
3.0390080863
4.3313271487
6.2831853013
5.1100022614
2.9463140214
5.1760365870
5.6991835706
2.0611798614
6.2831853013
2.2278897808
6.1707748575
6.2831853013
6...

result:

ok 10000 numbers

Test #8:

score: 0
Accepted
time: 551ms
memory: 4404kb

input:

100
1413 755
-30 -30
-30 -28
-30 -27
-30 -26
-30 -21
-30 -12
-30 -10
-30 -8
-30 -5
-30 -1
-30 2
-30 4
-30 7
-30 9
-30 17
-30 19
-30 20
-30 23
-30 24
-30 30
-29 -29
-29 -23
-29 -15
-29 0
-29 4
-29 5
-29 9
-29 10
-29 11
-29 12
-29 14
-29 16
-29 17
-29 22
-29 27
-29 28
-28 -28
-28 -25
-28 -23
-28 -22
-...

output:

3.5891126241
2.9797552169
0.2837941056
2.0350277021
4.8879811415
1.0040671060
4.7457099708
5.3255963257
4.3102749617
5.6033836780
1.5798050875
4.3296454658
5.5472220949
1.4601391025
1.5310445475
2.8716749287
2.6325789625
3.1240505922
0.6805212210
5.4201656292
4.7789571424
2.4030352019
4.2799811994
4...

result:

ok 100 numbers

Test #9:

score: 0
Accepted
time: 695ms
memory: 4536kb

input:

20
9045 8319
-1000 -986
-1000 -683
-1000 -430
-1000 -292
-1000 53
-1000 667
-999 -855
-999 -350
-999 -174
-999 -51
-999 -43
-999 235
-999 465
-999 530
-998 -997
-998 -311
-998 21
-998 44
-998 182
-997 -313
-997 -195
-997 -13
-997 412
-997 425
-996 -542
-996 -348
-996 -126
-996 -59
-996 -40
-996 84
-...

output:

5.9115110032
3.7438685133
2.5384828545
2.1599673546
4.2950377044
4.7716744729
4.6824078085
5.0789843897
1.6008018182
3.3404025418
3.3687925269
2.1130160229
4.8553994045
4.3240010480
0.1078535593
0.1798211237
5.3766547590
4.4495660220
4.3944016633
2.9381848666

result:

ok 20 numbers

Test #10:

score: 0
Accepted
time: 812ms
memory: 13836kb

input:

1
166347 18723
-1000 -979
-1000 -975
-1000 -928
-1000 -914
-1000 -898
-1000 -889
-1000 -876
-1000 -873
-1000 -858
-1000 -840
-1000 -838
-1000 -801
-1000 -783
-1000 -744
-1000 -738
-1000 -733
-1000 -713
-1000 -712
-1000 -695
-1000 -689
-1000 -680
-1000 -675
-1000 -671
-1000 -646
-1000 -643
-1000 -608...

output:

0.8514491780

result:

ok found '0.8514492', expected '0.8514492', error '0.0000000'

Test #11:

score: 0
Accepted
time: 904ms
memory: 21600kb

input:

1
154903 84960
-1000 -979
-1000 -965
-1000 -956
-1000 -945
-1000 -920
-1000 -901
-1000 -878
-1000 -860
-1000 -858
-1000 -709
-1000 -693
-1000 -648
-1000 -619
-1000 -602
-1000 -579
-1000 -474
-1000 -473
-1000 -454
-1000 -443
-1000 -427
-1000 -407
-1000 -403
-1000 -384
-1000 -351
-1000 -279
-1000 -244...

output:

3.5389266811

result:

ok found '3.5389267', expected '3.5389267', error '0.0000000'

Test #12:

score: 0
Accepted
time: 937ms
memory: 22480kb

input:

1
158037 96343
-1000 -1000
-1000 -905
-1000 -881
-1000 -833
-1000 -804
-1000 -803
-1000 -782
-1000 -775
-1000 -765
-1000 -759
-1000 -756
-1000 -748
-1000 -722
-1000 -674
-1000 -669
-1000 -630
-1000 -610
-1000 -573
-1000 -443
-1000 -411
-1000 -409
-1000 -403
-1000 -388
-1000 -366
-1000 -349
-1000 -33...

output:

3.9720287747

result:

ok found '3.9720288', expected '3.9720288', error '0.0000000'

Test #13:

score: 0
Accepted
time: 185ms
memory: 4236kb

input:

10000
17 12
-853202371 684059854
-659446544 -924219854
-418025687 117998679
-399757126 -365708913
-331597239 -270896799
-204989763 869548983
-118492298 963842298
-77481232 672198731
45930201 -58234380
52605147 -900097542
78371985 940503934
235210685 595759114
391284089 234315077
416229789 -827244230...

output:

5.3985251092
5.3739078728
1.1735781683
1.5443652592
3.7782886467
3.5704715836
6.2829748576
5.0959251976
2.9875782416
2.3055665001
3.3907841589
5.7854732376
4.8109636073
0.9567574120
4.6294317296
4.7995080576
4.1702889042
5.7394776946
6.1210294459
3.5674682889
6.2280647191
6.2825675695
4.0146545561
0...

result:

ok 10000 numbers

Test #14:

score: 0
Accepted
time: 279ms
memory: 4260kb

input:

1000
133 108
-994106086 710243426
-991027749 -548437545
-983318226 -917527783
-943673956 -368162275
-935819096 616077188
-928022346 487569673
-924213856 -369318351
-914827619 426646545
-883935180 590882141
-870015071 -270471333
-834927107 -211343853
-829266515 354007200
-788041913 -60481736
-7822837...

output:

5.7428017898
1.9153642392
3.8043457924
1.7919162657
3.1695206667
6.0786462105
3.7860674561
3.6659690677
6.2265834501
5.9021521896
5.9443157065
0.7151676855
3.8315742499
1.2228457148
2.5984264612
5.5473289172
4.0791947392
0.7042209913
5.8578224247
0.6894854447
0.9379821517
1.4215226939
4.2713262776
3...

result:

ok 1000 numbers

Test #15:

score: 0
Accepted
time: 607ms
memory: 4372kb

input:

100
1367 924
-999416811 990355566
-997656126 346133696
-997071616 -657387469
-996176051 12622726
-995720693 334093112
-995478093 891631278
-994503890 341858449
-994297596 499383911
-993234202 533518057
-991636838 -4170504
-990563582 -407186200
-989454027 653116272
-989132124 -780605454
-988073521 -1...

output:

4.5051534857
2.7125589293
5.8396785773
6.0229771100
0.4616060401
0.9869912298
1.3219708436
1.9258417404
5.5086083488
4.6463553277
2.2876774053
2.1848725870
4.8094091866
0.4770789852
0.5563416013
1.0936191622
5.1827145506
3.1131846570
4.3802339513
2.7492592780
2.7917953298
6.2717333562
5.7538750439
2...

result:

ok 100 numbers

Test #16:

score: 0
Accepted
time: 798ms
memory: 5008kb

input:

10
13806 4955
-999669776 933068103
-999542354 721337508
-999499427 357140594
-999429088 -925180511
-999334813 -145726169
-999291694 -886327684
-999281647 811188099
-999145269 860687107
-998961821 -979442436
-998769313 446186367
-998591455 658309173
-998539751 -569480843
-998479467 279850955
-9984754...

output:

2.4170804677
6.1611922233
3.9600203766
3.9943617875
2.5515508326
0.5227238316
4.0978438257
6.2103826623
5.9817280282
0.7772236815

result:

ok 10 numbers

Test #17:

score: 0
Accepted
time: 748ms
memory: 13492kb

input:

1
112596 94970
-999980219 399324466
-999932413 952114487
-999894556 -951211102
-999891030 -996222974
-999864824 412806264
-999853190 -269700371
-999845814 -23906803
-999841507 -459154880
-999825178 716247149
-999761774 -154047106
-999729655 -171480333
-999709604 -666447277
-999704754 -22442485
-9996...

output:

5.4425938779

result:

ok found '5.4425939', expected '5.4425939', error '0.0000000'

Test #18:

score: 0
Accepted
time: 883ms
memory: 13684kb

input:

1
161568 13252
-999991243 -113889211
-999976572 -361096764
-999970140 -505012445
-999960654 600963873
-999959339 -269932510
-999956568 734634576
-999941447 716485764
-999940305 64397798
-999939982 746532931
-999939921 995002380
-999932747 185078659
-999927136 585216518
-999914684 898656539
-99990452...

output:

0.6424745898

result:

ok found '0.6424746', expected '0.6424746', error '0.0000000'

Test #19:

score: -100
Time Limit Exceeded

input:

1
186192 126483
-999998234 974001047
-999976292 -133179660
-999967957 112862981
-999957851 70030467
-999951528 743907713
-999931316 66002112
-999907988 888991267
-999905412 470798211
-999903986 -103943462
-999900422 255729004
-999898174 917068198
-999884392 -183592605
-999880179 -650076162
-99987469...

output:


result: