# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
25972 | 2017-06-25T09:11:21 Z | dotorya | The Forest of Fangorn (CEOI14_fangorn) | C++14 | 2019 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
# | Verdict | Execution time | Memory | 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 |
# | Verdict | Execution time | Memory | 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 |
# | Verdict | Execution time | Memory | 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 | 106 ms | 2220 KB | Output is correct |
5 | Correct | 19 ms | 2220 KB | Output is correct |
6 | Correct | 509 ms | 2360 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 683 ms | 2360 KB | Output is correct |
2 | Correct | 1663 ms | 2360 KB | Output is correct |
3 | Correct | 2019 ms | 2360 KB | Output is correct |
4 | Correct | 1586 ms | 2360 KB | Output is correct |