Submission #3808

#TimeUsernameProblemLanguageResultExecution timeMemory
3808gs13068Divide into triangle (kriii1_D)C++98
1 / 1
4 ms1096 KiB
#include<cstdio> int x[900]; int y[900]; bool no[900]; int main() { double t; int bot; int i,j,k,n; scanf("%d",&n); for(i=0;i<n*3;i++)scanf("%d%d",&x[i],&y[i]); j=0; for(i=1;i<n*3;i++) { if(y[i]<y[j]) j=i; } printf("%d ",j+1); no[j]=true; bot=j; for(i=1;i<n*3;i++) { for(k=0;no[k];k++); for(j=k+1;j<n*3;j++) { if(no[j])continue; if(1LL*(x[j]-x[bot])*(y[k]-y[bot])<1LL*(x[k]-x[bot])*(y[j]-y[bot])) k=j; } printf("%d ",k+1); no[k]=true; if(i%3==2)puts(""); } }
#Verdict Execution timeMemoryGrader output
Fetching results...