QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#828068#8946. 一眼丁真275307894a#Compile Error//C++142.3kb2024-12-23 12:52:382024-12-23 12:52:38

Judging History

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

  • [2024-12-23 12:52:38]
  • 评测
  • [2024-12-23 12:52:38]
  • 提交

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

answer.code: In function ‘void Solve()’:
answer.code:53:104: error: expected primary-expression before ‘;’ token
   53 |         for(int i=1;i<sh;i++) tot+=cross(st[i],st[i+1]),/*cerr<<st[i].real()<<' '<<st[i].imag()<<'\n'*/;
      |                                                                                                        ^
answer.code:35:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   35 |         scanf("%d%d",&k,&n);
      |         ~~~~~^~~~~~~~~~~~~~
answer.code:37:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   37 |                 db x,y;scanf("%lf%lf",&x,&y);
      |                        ~~~~~^~~~~~~~~~~~~~~~
answer.code: In function ‘int main()’:
answer.code:77:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   77 |         scanf("%d",&t);
      |         ~~~~~^~~~~~~~~