QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#828072#8946. 一眼丁真275307894a#0 61ms8108kbC++142.3kb2024-12-23 12:53:082024-12-23 12:53:10

Judging History

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

  • [2024-12-23 12:53:10]
  • 评测
  • 测评结果:0
  • 用时:61ms
  • 内存:8108kb
  • [2024-12-23 12:53:08]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=5e5+5,M=N*4+5,K=1000+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(28382);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
	Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
	Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
	#ifdef LOCAL
	#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
	#else 
	#define gdb(...) void()
	#endif
}using namespace Debug;
using cp=complex<db>;
int k,n;
cp A[N],st[N];int sh;
db cross(cp x,cp y){return x.real()*y.imag()-x.imag()*y.real();}
db w[N];
// auto is=fopen("1.ans","r");
void Solve(){
	// int as=0;fscanf(is,"%d",&as);
	scanf("%d%d",&k,&n);
	for(int i=1;i<=k;i++){
		db x,y;scanf("%lf%lf",&x,&y);
		A[i]=cp(x,y);
	}
	sort(A+1,A+k+1,[](cp x,cp y){return make_pair(x.real(),x.imag())<make_pair(y.real(),y.imag());});
	sh=0;
	for(int i=1;i<=k;i++){
		while(sh>1&&cross(st[sh]-st[sh-1],A[i]-st[sh])<0) sh--;
		st[++sh]=A[i];
	}
	db tot=0;
	for(int i=1;i<sh;i++) tot+=cross(st[i],st[i+1])/*,cerr<<st[i].real()<<' '<<st[i].imag()<<'\n'*/;
	sh=0;
	for(int i=k;i;i--){
		while(sh>1&&cross(st[sh]-st[sh-1],A[i]-st[sh])<0) sh--;
		st[++sh]=A[i];
	}
	for(int i=1;i<sh;i++) tot+=cross(st[i],st[i+1])/*,cerr<<st[i].real()<<' '<<st[i].imag()<<'\n'*/;
	tot/=2;
	cout<<tot<<'\n';
	// if(as==4) gdb(tot);
	if(tot<2.7){
		puts("3");
	}else{
		puts("4");
	}
	
	return;
	// gdb(tot);
	for(int i=max(3,n-5);i<=n;i++){
		db ap=acos(-1)/i;
		w[i]=sin(ap)*cos(ap)*i;
		w[i]=sqrt(tot/w[i]);
		// gdb(i,w[i]);
	}
	int mi=n;
	for(int i=max(n-5,3);i<=n;i++) if(abs(w[i]-1.35)<=abs(w[mi]-1.35)) mi=i;
	printf("%d\n",mi);
}
int main(){
	int t=1;
	scanf("%d",&t);
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

Details

Tip: Click on the bar to expand more detailed information

Pretests


Final Tests

Test #1:

score: 0
Wrong Answer
time: 60ms
memory: 8056kb

input:

200
1000 4
-1.65882 -0.468078
-0.559879 0.302541
-1.67025 -0.452322
-0.54312 -1.40252
0.116365 -0.958391
-1.57137 -0.386501
-1.20353 -0.13415
0.123479 -0.934878
-0.597084 -1.41011
-1.69629 -0.489381
-0.0114821 -1.03665
-0.546439 -1.39593
-0.573469 -1.41618
-1.06124 -1.4763
-1.52521 -0.371347
-1.4609...

output:

2.13753
3
2.13488
3
1.43556
3
2.13286
3
2.14139
3
1.42468
3
1.4152
3
2.13769
3
2.13409
3
1.41488
3
2.12831
3
2.12414
3
2.12063
3
1.41497
3
2.14818
3
2.13958
3
1.42006
3
2.15097
3
2.14109
3
2.15914
3
2.13771
3
1.43991
3
2.12985
3
1.43141
3
2.12884
3
1.41487
3
1.43137
3
1.41556
3
2.12922
3
1.42739
3
1...

result:

wrong output format Expected integer, but "2.13753" found

Test #2:

score: 0
Wrong Answer
time: 56ms
memory: 8060kb

input:

200
1000 4
0.22827 0.536959
-0.743134 0.215561
-0.0821736 -0.804273
0.470104 -0.194576
0.819679 0.553173
0.212657 0.515942
-0.379762 -0.349824
0.140334 -0.864474
-0.033494 0.513621
0.673108 0.243877
0.716308 0.318053
-0.108843 -0.719375
0.102132 -0.924612
0.0141018 -0.921927
0.710421 0.53719
-0.4572...

output:

1.42859
3
2.12564
3
1.43538
3
2.13463
3
1.41884
3
1.42204
3
1.43074
3
1.42155
3
2.13891
3
1.42855
3
2.14046
3
2.12319
3
2.13235
3
2.1176
3
2.1244
3
2.15126
3
2.13197
3
1.42731
3
2.13756
3
2.1452
3
1.42839
3
1.43229
3
1.42305
3
2.13582
3
2.135
3
2.13108
3
2.12696
3
2.13152
3
1.42403
3
1.43241
3
1.413...

result:

wrong output format Expected integer, but "1.42859" found

Test #3:

score: 0
Wrong Answer
time: 57ms
memory: 8052kb

input:

200
1000 10
0.171063 0.768938
0.339764 0.873943
1.15161 0.672578
0.805594 0.765797
1.15695 0.666805
1.26595 -0.695135
1.20927 0.578729
-0.356686 -0.292753
0.940372 -0.919379
-0.269337 -0.62435
-0.0757841 0.550908
1.52432 0.00176461
-0.366525 0.00974288
0.524328 0.851771
1.37215 0.224858
0.655827 -0....

output:

2.86717
4
3.0573
4
2.85794
4
2.50789
3
2.7335
4
2.97395
4
3.06688
4
2.72516
4
2.95015
4
3.05965
4
3.02545
4
2.51864
3
3.0135
4
2.72239
4
3.0673
4
2.86278
4
2.8614
4
2.51146
3
3.06654
4
2.73742
4
3.06681
4
2.87233
4
2.86934
4
3.06293
4
2.86886
4
2.95777
4
2.96661
4
2.85997
4
2.86434
4
2.86696
4
3.070...

result:

wrong output format Expected integer, but "2.86717" found

Test #4:

score: 0
Wrong Answer
time: 51ms
memory: 8092kb

input:

200
1000 10
-0.83557 -0.43386
-0.900052 0.302486
0.843787 0.446154
-0.0854311 -0.918758
0.501433 0.844022
-0.955344 -0.173521
0.516729 0.8388
-0.917289 0.0698801
-0.925852 0.0681056
-0.848415 0.471305
0.098655 0.922883
0.958545 0.273256
0.67931 0.611085
-0.951816 -0.0694206
-0.245102 0.947475
0.9397...

output:

2.95997
4
3.07136
4
3.06417
4
2.72352
4
2.86634
4
3.02319
4
2.86512
4
3.03399
4
3.06577
4
2.96218
4
2.72408
4
2.51427
3
3.06269
4
2.86557
4
3.0187
4
2.95586
4
2.73232
4
3.06534
4
2.95905
4
2.87666
4
2.97282
4
2.50873
3
2.73587
4
2.96459
4
2.72475
4
2.88281
4
2.5196
3
2.86606
4
3.01685
4
2.72276
4
2....

result:

wrong output format Expected integer, but "2.95997" found

Test #5:

score: 0
Wrong Answer
time: 61ms
memory: 8040kb

input:

200
1000 20
1.10645 1.72762
0.00828014 0.0575131
-0.300448 0.537454
0.138879 1.67906
0.73884 1.83804
-0.331532 1.01263
1.57294 1.17098
1.61097 0.722726
0.267742 1.7481
0.805786 -0.115483
1.63489 0.918378
0.358705 -0.0984941
-0.303133 1.14962
1.59952 1.0805
-0.22276 1.35792
1.06748 1.74928
1.48122 1....

output:

3.19679
4
3.19516
4
3.20579
4
3.1931
4
3.20377
4
3.18645
4
3.20709
4
3.20049
4
3.18374
4
3.17041
4
3.1826
4
3.2005
4
3.18213
4
3.18363
4
3.20091
4
3.20889
4
3.20646
4
3.18607
4
3.19802
4
3.19618
4
3.16884
4
3.19627
4
3.20395
4
3.18837
4
3.18894
4
3.16619
4
3.17494
4
3.20684
4
3.1703
4
3.19433
4
3.19...

result:

wrong output format Expected integer, but "3.19679" found

Test #6:

score: 0
Wrong Answer
time: 59ms
memory: 8108kb

input:

200
1000 20
0.306231 0.947555
-0.470695 -0.867584
0.0798229 -0.979712
0.972425 -0.18076
0.205552 0.977367
0.503871 -0.843521
0.931879 -0.34759
-0.528287 -0.821234
0.384399 0.889843
0.0427201 -0.995252
0.911209 0.407903
-0.925169 0.281163
1.01054 0.00777535
0.829844 0.506267
0.145597 -0.98502
-0.2980...

output:

3.20108
4
3.20029
4
3.19188
4
3.16404
4
3.2068
4
3.17283
4
3.16899
4
3.1743
4
3.19369
4
3.17687
4
3.19612
4
3.19621
4
3.19909
4
3.15894
4
3.20244
4
3.20001
4
3.19976
4
3.21608
4
3.19505
4
3.17401
4
3.20336
4
3.19058
4
3.19063
4
3.18226
4
3.20874
4
3.17122
4
3.18293
4
3.17501
4
3.17602
4
3.17981
4
3....

result:

wrong output format Expected integer, but "3.20108" found

Test #7:

score: 0
Wrong Answer
time: 57ms
memory: 8044kb

input:

200
1000 25
-0.150207 0.698438
0.0893216 1.09445
1.69859 -0.01418
0.00876932 1.00054
-0.0563829 0.902229
0.736602 1.41841
-0.147213 0.274848
-0.182403 0.345741
1.63542 -0.149404
1.80616 0.580086
1.56376 -0.247799
0.32449 1.26092
0.627195 1.41568
-0.0382449 -0.105866
0.129226 1.13973
0.0847462 -0.261...

output:

3.22002
4
3.21018
4
3.22197
4
3.21629
4
3.20746
4
3.22549
4
3.20602
4
3.20778
4
3.22425
4
3.20759
4
3.20877
4
3.22224
4
3.2052
4
3.21716
4
3.21209
4
3.20717
4
3.21578
4
3.21588
4
3.2288
4
3.21095
4
3.21073
4
3.20621
4
3.22009
4
3.21459
4
3.21612
4
3.21717
4
3.21062
4
3.21783
4
3.21599
4
3.21813
4
3....

result:

wrong output format Expected integer, but "3.22002" found

Test #8:

score: 0
Wrong Answer
time: 60ms
memory: 8052kb

input:

200
1000 25
0.964683 -0.212993
0.98252 -0.136339
-0.168828 -0.971035
0.865174 -0.484339
0.571258 -0.82591
-0.797776 -0.589278
-0.307998 -0.948622
-0.80831 0.593024
-0.659663 0.745975
0.923635 -0.380449
0.996853 -0.0380425
0.679349 0.732259
-0.0225609 1.00911
0.717309 -0.710159
-0.425272 -0.901905
0....

output:

3.20515
4
3.22889
4
3.21698
4
3.22537
4
3.22827
4
3.21871
4
3.22592
4
3.22227
4
3.21089
4
3.20894
4
3.21744
4
3.21608
4
3.21131
4
3.22242
4
3.21369
4
3.22105
4
3.20999
4
3.2191
4
3.22052
4
3.21668
4
3.21873
4
3.20729
4
3.21341
4
3.22264
4
3.21997
4
3.22005
4
3.22349
4
3.22696
4
3.215
4
3.21736
4
3.2...

result:

wrong output format Expected integer, but "3.20515" found

Test #9:

score: 0
Wrong Answer
time: 57ms
memory: 8056kb

input:

200
1000 30
-0.823086 -1.0434
0.105428 -0.15483
-0.502513 -0.953264
0.0771079 -0.121858
-1.23449 0.876862
-0.0812511 -0.664993
-0.241982 0.678029
-0.622296 0.896641
-1.20049 0.882673
-1.88268 -0.190726
0.0489134 -0.354098
0.0159866 -0.415372
-0.167045 -0.751293
-0.0637444 -0.612609
0.0696068 -0.3288...

output:

3.23358
4
3.22959
4
3.22409
4
3.22273
4
3.22543
4
3.22073
4
3.23199
4
3.23078
4
3.23279
4
3.23626
4
3.23467
4
3.22581
4
3.22242
4
3.21667
4
3.22019
4
3.23294
4
3.22073
4
3.23739
4
3.22322
4
3.22647
4
3.22576
4
3.23102
4
3.22289
4
3.23194
4
3.22879
4
3.2249
4
3.23372
4
3.21852
4
3.22099
4
3.22669
4
3...

result:

wrong output format Expected integer, but "3.23358" found

Test #10:

score: 0
Wrong Answer
time: 55ms
memory: 8060kb

input:

200
1000 30
-0.922656 0.353773
0.603763 -0.788179
-0.461439 0.857645
-0.991954 -0.0838754
-0.144937 0.982998
0.605566 -0.771346
0.0629471 0.988433
0.995332 -0.0164629
-0.878948 0.473977
-0.852896 0.501311
0.840425 0.516425
0.440577 0.898323
-0.515795 0.861164
0.116181 -1.00427
-0.477573 -0.879226
0....

output:

3.21665
4
3.2263
4
3.22371
4
3.22758
4
3.21896
4
3.2214
4
3.22096
4
3.2251
4
3.22734
4
3.22361
4
3.23158
4
3.22207
4
3.23464
4
3.22389
4
3.23297
4
3.23306
4
3.22776
4
3.21985
4
3.22521
4
3.22448
4
3.21782
4
3.22479
4
3.22505
4
3.23795
4
3.23029
4
3.22797
4
3.23149
4
3.23142
4
3.22481
4
3.22842
4
3.2...

result:

wrong output format Expected integer, but "3.21665" found