답안 #25971

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
25971 2017-06-25T09:10:27 Z 도토리(#1092) The Forest of Fangorn (CEOI14_fangorn) C++14
100 / 100
1976 ms 2360 KB
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

pll operator - (pll a) {
	return pll(-a.first, -a.second);
}

pll operator - (pll a, pll b) {
	return pll(a.first - b.first, a.second - b.second);
}
ll ccw(pll a, pll b) {
	return a.first*b.second - a.second*b.first;
}

bool cmp(pll a, pll b) {
	if ((a > pll(0, 0)) != (b > pll(0, 0))) return a > pll(0, 0);
	return ccw(a, b) > 0;
}

pll in1[2050];
pll in2[10050];

bool chk[10050];

vector <pll> Vu;
int getp(pll a) {
	int st = 0, en = (int)Vu.size() - 1, mi, rv = -1;
	while (st <= en) {
		mi = (st + en) / 2;
		if (cmp(Vu[mi], a)) {
			rv = mi;
			st = mi + 1;
		}
		else en = mi - 1;
	}

	return (rv + 1) % (Vu.size());
}
int main() {
	int N, C, W, H, i, j;
	scanf("%d %d", &W, &H);
	scanf("%lld %lld", &in1[0].first, &in1[0].second);
	scanf("%d", &C);
	for (i = 1; i <= C; i++) scanf("%lld %lld", &in2[i].first, &in2[i].second);
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%lld %lld", &in1[i].first, &in1[i].second);

	for (i = 1; i <= N; i++) {
		for (j = 1; j <= N; j++) if (i != j) Vu.push_back(in1[i] - in1[j]);
		sort(all(Vu), [](pll a, pll b) {
			return cmp(a, b);
		});
		int p = getp(in1[0] - in1[i]);
		for (j = 1; j <= C; j++) if (p != getp(in2[j] - in1[i])) chk[j] = true;
		Vu.clear();
	}
	int ans = 0;
	for (i = 1; i <= C; i++) if (!chk[i]) ans++;
	printf("%d\n", ans);
	for (i = 1; i <= C; i++) if(!chk[i]) printf("%d ", i);
	return !printf("\n");
}

Compilation message

fangorn.cpp:23:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning(disable:4996)  
 ^
fangorn.cpp:24:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
 #pragma comment(linker, "/STACK:336777216")  
 ^
fangorn.cpp: In function 'int main()':
fangorn.cpp:90:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &W, &H);
                        ^
fangorn.cpp:91:51: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld", &in1[0].first, &in1[0].second);
                                                   ^
fangorn.cpp:92:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &C);
                 ^
fangorn.cpp:93:76: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (i = 1; i <= C; i++) scanf("%lld %lld", &in2[i].first, &in2[i].second);
                                                                            ^
fangorn.cpp:94:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
                 ^
fangorn.cpp:95:76: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (i = 1; i <= N; i++) scanf("%lld %lld", &in1[i].first, &in1[i].second);
                                                                            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2220 KB Output is correct
2 Correct 0 ms 2220 KB Output is correct
3 Correct 0 ms 2220 KB Output is correct
4 Correct 0 ms 2220 KB Output is correct
5 Correct 0 ms 2220 KB Output is correct
6 Correct 0 ms 2220 KB Output is correct
7 Correct 0 ms 2220 KB Output is correct
8 Correct 0 ms 2220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2220 KB Output is correct
2 Correct 0 ms 2220 KB Output is correct
3 Correct 0 ms 2220 KB Output is correct
4 Correct 0 ms 2220 KB Output is correct
5 Correct 0 ms 2220 KB Output is correct
6 Correct 0 ms 2220 KB Output is correct
7 Correct 0 ms 2220 KB Output is correct
8 Correct 0 ms 2220 KB Output is correct
9 Correct 0 ms 2220 KB Output is correct
10 Correct 3 ms 2220 KB Output is correct
11 Correct 3 ms 2220 KB Output is correct
12 Correct 3 ms 2220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2220 KB Output is correct
2 Correct 0 ms 2220 KB Output is correct
3 Correct 0 ms 2220 KB Output is correct
4 Correct 109 ms 2220 KB Output is correct
5 Correct 19 ms 2220 KB Output is correct
6 Correct 469 ms 2360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 653 ms 2360 KB Output is correct
2 Correct 1643 ms 2360 KB Output is correct
3 Correct 1976 ms 2360 KB Output is correct
4 Correct 1513 ms 2360 KB Output is correct