답안 #287118

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
287118 2020-08-31T12:02:34 Z TadijaSebez The Forest of Fangorn (CEOI14_fangorn) C++11
100 / 100
2765 ms 868 KB
#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

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);
      |  ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 7 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 144 ms 384 KB Output is correct
5 Correct 32 ms 384 KB Output is correct
6 Correct 552 ms 432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 874 ms 480 KB Output is correct
2 Correct 2765 ms 704 KB Output is correct
3 Correct 595 ms 640 KB Output is correct
4 Correct 2029 ms 868 KB Output is correct