# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29686 | 2017-07-20T10:40:44 Z | rondojim | The Forest of Fangorn (CEOI14_fangorn) | C++14 | 649 ms | 2120 KB |
#include <stdio.h> #include <algorithm> #include <vector> using namespace std; struct pt{ pt(){x = y = p = 0;}; pt(int x_, int y_){ x = x_; y = y_; p = -1; if (y == 0 && x > 0) p = 0; if (y > 0) p = 1; if (y == 0 && x < 0) p = 2; if (y < 0) p = 3; } int x,y,p; bool operator <(const pt& t) const{ if (p != t.p) return p < t.p; return (long long) y * t.x < (long long) t.y * x; }; }P[4040]; int main() { scanf ("%*d %*d"); int x,y; scanf ("%d %d",&x,&y); int M, CX[10020], CY[10020]; scanf ("%d",&M); for (int i=0;i<M;i++) scanf ("%d %d",&CX[i],&CY[i]); int N, TX[2020], TY[2020]; scanf ("%d",&N); for (int i=0;i<N;i++) scanf ("%d %d",&TX[i],&TY[i]); vector<int> res; for (int i=0;i<M;i++) res.push_back(i); for (int i=0;i<N;i++){ int c = 0; for (int j=0;j<N;j++) if (i != j){ pt u(-(TX[j]-TX[i]),-(TY[j]-TY[i])); P[c++] = u; if (u.p == 0 || u.p == 1){ u.p += 4; P[c++] = u; } } pt v(x-TX[i],y-TY[i]); P[c++] = v; sort(P,P+c); for (int j=0;j<c;j++) if (P[j].x == v.x && P[j].y == v.y){ vector<int> nxt; for (auto &k : res){ pt u(CX[k] - TX[i], CY[k] - TY[i]); if (P[j-1] < u && u < P[j+1]){nxt.push_back(k); continue;} u.p += 4; if (P[j-1] < u && u < P[j+1]) nxt.push_back(k); } res = nxt; break; } } printf ("%d\n",res.size()); for (auto &x : res) printf ("%d ",++x); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 1980 KB | Output isn't correct |
2 | Correct | 0 ms | 1980 KB | Output is correct |
3 | Incorrect | 0 ms | 1980 KB | Output isn't correct |
4 | Correct | 0 ms | 1980 KB | Output is correct |
5 | Incorrect | 0 ms | 1980 KB | Output isn't correct |
6 | Correct | 0 ms | 1980 KB | Output is correct |
7 | Correct | 0 ms | 1980 KB | Output is correct |
8 | Correct | 0 ms | 1980 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1980 KB | Output is correct |
2 | Correct | 0 ms | 1980 KB | Output is correct |
3 | Correct | 0 ms | 1980 KB | Output is correct |
4 | Correct | 0 ms | 1980 KB | Output is correct |
5 | Correct | 0 ms | 1980 KB | Output is correct |
6 | Correct | 0 ms | 1980 KB | Output is correct |
7 | Correct | 0 ms | 1980 KB | Output is correct |
8 | Incorrect | 0 ms | 1980 KB | Output isn't correct |
9 | Incorrect | 0 ms | 1980 KB | Output isn't correct |
10 | Correct | 3 ms | 1980 KB | Output is correct |
11 | Correct | 3 ms | 1980 KB | Output is correct |
12 | Correct | 3 ms | 1980 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1980 KB | Output is correct |
2 | Incorrect | 0 ms | 1980 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 593 ms | 1980 KB | Output is correct |
2 | Incorrect | 649 ms | 2120 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |