Submission #287118

#TimeUsernameProblemLanguageResultExecution timeMemory
287118TadijaSebezThe Forest of Fangorn (CEOI14_fangorn)C++11
100 / 100
2765 ms868 KiB
#include <bits/stdc++.h> using namespace std; #define ldb long double #define base complex<ldb> const ldb PI=acos(-1); ldb ang(base x){ldb a=arg(x);return a<0?a+2*PI:a;} base rd(){int x,y;scanf("%i %i",&x,&y);return base(x,y);} const int N=2050; const int M=10050; base a[N],b[M],c; bool bad[M]; int main(){ int n,m,h,w; scanf("%i %i",&h,&w); c=rd(); scanf("%i",&m); for(int i=1;i<=m;i++)b[i]=rd(); scanf("%i",&n); for(int i=1;i<=n;i++)a[i]=rd(); for(int i=1;i<=n;i++){ ldb mn=2*PI,mx=0; for(int j=1;j<=n;j++)if(i!=j){ ldb alpha=ang((a[i]-a[j])/(c-a[i])); mn=min(mn,alpha); mx=max(mx,alpha); } for(int j=1;j<=m;j++)if(!bad[j]){ ldb alpha=ang((b[j]-a[i])/(c-a[i])); if(alpha>=mn&&alpha<=mx)bad[j]=1; } } int cnt=0; for(int i=1;i<=m;i++)cnt+=!bad[i]; printf("%i\n",cnt); for(int i=1;i<=m;i++)if(!bad[i])printf("%i ",i); return 0; }

Compilation message (stderr)

fangorn.cpp: In function 'std::complex<long double> rd()':
fangorn.cpp:7:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 | base rd(){int x,y;scanf("%i %i",&x,&y);return base(x,y);}
      |                   ~~~~~^~~~~~~~~~~~~~~
fangorn.cpp: In function 'int main()':
fangorn.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |  scanf("%i %i",&h,&w);
      |  ~~~~~^~~~~~~~~~~~~~~
fangorn.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |  scanf("%i",&m);
      |  ~~~~~^~~~~~~~~
fangorn.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |  scanf("%i",&n);
      |  ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...