답안 #110573

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
110573 2019-05-11T08:17:12 Z MAMBA The Forest of Fangorn (CEOI14_fangorn) C++17
100 / 100
2681 ms 832 KB
#include <bits/stdc++.h> 

using namespace std;

#define rep(i , j , k) for (int i = j; i < k; i++)
#define pb push_back
#define mt make_tuple
#define for_all(x) x.begin(),x.end()

typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef long double ld;
typedef complex<ld> point;

inline void fileIO(string s) {
	freopen((s + ".in").c_str(), "r", stdin);
	freopen((s + ".out").c_str(), "w", stdout);
}

template<class T , class S>
inline bool smin(T &a, S b) { return (T)b < a ? a = b , 1 : 0; }
template<class T , class S>
inline bool smax(T &a, S b) { return a < (T)b ? a = b , 1 : 0; }

constexpr int N = 1e4 + 10;

constexpr int MOD = 1e9 + 7;

template<typename T>
inline T mod(T &v) { return v = (v % MOD + MOD) % MOD; }
template<typename S, typename T>
inline S add(S &l, T r) { return mod(l += r); }

ll po(ll v, ll u) { return u ? po(v * v % MOD , u >> 1) * (u & 1 ? v : 1) % MOD : 1; }

int n , c;
ld junk, x , y;
point a[N], b[N], s, p[N];
bitset<N> res;

const ld PI = atan2(0 , -1); 

inline ld arg2(point p2) {
	ld me = arg(p2);
	if (me < 0)
		me += 2 * PI;
	return me;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

#ifndef LOCAL
	//	fileIO("forbidden1");
#endif

	cin >> junk >> junk >> x >> y >> c;
	s = point(x , y);

	rep(i , 0 , c) {
		cin >>x >> y;
		a[i] = point(x , y);
	}
	cin >> n;
	rep(i , 0 , n) {
		cin >> x >> y;
		b[i]= point(x , y);
	}

	res.set();
	rep(i , 0 , n) {
		rep(j , 0 , n)
			p[j] =  b[i] - b[j];
		point local = s - b[i];
		rep(j , 0 , n)
			p[j] /= local;
		ld lval = 2 * PI, rval = 0;
		rep(j , 0 , n) 
			if (j != i) {
			//	cout << i << ' ' << j << ' '<< arg2(p[j]) / PI << endl;
				smin(lval , arg2(p[j]));
				smax(rval , arg2(p[j]));
			}
		rep(j , 0 , c) {
			ld me = arg2((a[j] - b[i]) / local); 
			if (me > lval && me < rval) {
			//	cout << i << ' '<< j << " :: " << endl;
				res[j] = false;
			}
		}
	}

	vi vec;
	rep(i , 0 , c)
		if (res[i])
			vec.pb(i);

	cout << vec.size() << endl;
	for (auto e :vec) cout << e + 1 << ' ';

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 368 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 3 ms 392 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 9 ms 384 KB Output is correct
11 Correct 9 ms 512 KB Output is correct
12 Correct 10 ms 428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 185 ms 460 KB Output is correct
5 Correct 42 ms 384 KB Output is correct
6 Correct 680 ms 536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 987 ms 572 KB Output is correct
2 Correct 2369 ms 792 KB Output is correct
3 Correct 2540 ms 812 KB Output is correct
4 Correct 2681 ms 832 KB Output is correct