# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
349197 | 2021-01-17T04:10:59 Z | arnold518 | Fence (CEOI08_fence) | C++14 | 446 ms | 492 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 100; struct Point { int x, y; }; Point operator + (Point p, Point q) { return {p.x+q.x, p.y+q.y}; } Point operator - (Point p, Point q) { return {p.x-q.x, p.y-q.y}; } ll ccw(Point p, Point q) { return p.x*q.y-p.y*q.x; } int N, M; Point A[MAXN+10], B[MAXN+10]; int C[MAXN+10][MAXN+10]; int dp[MAXN+10], ans=987654321; int main() { scanf("%d%d", &N, &M); for(int i=1; i<=N; i++) scanf("%d%d", &A[i].x, &A[i].y); for(int i=1; i<=M; i++) scanf("%d%d", &B[i].x, &B[i].y); for(int i=1; i<=N; i++) { vector<int> V; for(int j=1; j<=N; j++) if(i!=j) V.push_back(j); sort(V.begin(), V.end(), [&](const int &p, const int &q) { return ccw(A[p]-A[i], A[q]-A[i])>0; }); for(int j=1; j<=N; j++) { if(j==i) continue; for(int k=1; k<=N; k++) { if(k==i) continue; if(k==j) continue; C[j][k]=0; for(int p=1; p<=M; p++) { if(ccw(A[j]-A[i], B[p]-A[i])>0 && ccw(A[k]-A[j], B[p]-A[j])>0 && ccw(A[i]-A[k], B[p]-A[k])>0) C[j][k]++; } } } for(int j=0; j<V.size(); j++) { dp[j]=40; for(int k=0; k<j; k++) { dp[j]=min(dp[j], dp[k]+20-C[V[k]][V[j]]*111); } ans=min(ans, dp[j]); } } printf("%d\n", ans+M*111); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 364 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 364 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 32 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 90 ms | 492 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 212 ms | 492 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 446 ms | 424 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |