# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
25972 | dotorya | The Forest of Fangorn (CEOI14_fangorn) | C++14 | 2019 ms | 2360 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |