답안 #287117

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
287117 2020-08-31T12:01:50 Z TadijaSebez The Forest of Fangorn (CEOI14_fangorn) C++11
80 / 100
3000 ms 884 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++){
			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 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 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 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 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 6 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 147 ms 384 KB Output is correct
5 Correct 34 ms 384 KB Output is correct
6 Correct 558 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 898 ms 524 KB Output is correct
2 Correct 2894 ms 884 KB Output is correct
3 Execution timed out 3064 ms 768 KB Time limit exceeded
4 Halted 0 ms 0 KB -