# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
105799 | 2019-04-15T00:50:27 Z | gs18103 | None (KOI16_dist) | C++ | 95 ms | 636 KB |
#include <bits/stdc++.h> using namespace std; long long arr[1010][4]; long long ans; int n, T; long long dp[10101010]; long long cal_dis(int t) { if(dp[t] != 0) return dp[t]; long long dis = 0; for(int i = 0; i < n; i++) { for(int j = 0; j < i; j++) { dis = max(dis, (arr[i][0]-arr[j][0]+t*(arr[i][2]-arr[j][2]))*(arr[i][0]-arr[j][0]+t*(arr[i][2]-arr[j][2]))+ (arr[i][1]-arr[j][1]+t*(arr[i][3]-arr[j][3]))*(arr[i][1]-arr[j][1]+t*(arr[i][3]-arr[j][3]))); } } return dp[t] = dis; } int search(int s, int e) { if(s + 5 >= e) { long long dis = 10000000000000000LL; for(int i = s; i <= e; i++) dis = min(dis, cal_dis(i)); for(int i = s; i <= e; i++) if(dis == cal_dis(i)) return i; } int t1 = (2 * s + e) / 3, t2 = (s + 2 * e) / 3; long long dis1 = cal_dis(t1), dis2 = cal_dis(t2); if(dis1 <= dis2) return search(s, t2); else return search(t1, e); } int main() { scanf("%d %d", &n, &T); for(int i = 0; i < n; i++) for(int j = 0; j < 4; j++) scanf("%lld", &arr[i][j]); int ans = search(0, T); printf("%d\n%lld", ans, cal_dis(ans)); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 512 KB | Output is correct |
2 | Correct | 3 ms | 512 KB | Output is correct |
3 | Correct | 3 ms | 512 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 512 KB | Output is correct |
6 | Correct | 3 ms | 512 KB | Output is correct |
7 | Correct | 3 ms | 512 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 512 KB | Output is correct |
2 | Correct | 3 ms | 512 KB | Output is correct |
3 | Correct | 3 ms | 512 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 512 KB | Output is correct |
6 | Correct | 3 ms | 512 KB | Output is correct |
7 | Correct | 3 ms | 512 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 78 ms | 548 KB | Output is correct |
12 | Correct | 72 ms | 632 KB | Output is correct |
13 | Correct | 75 ms | 632 KB | Output is correct |
14 | Correct | 71 ms | 632 KB | Output is correct |
15 | Correct | 79 ms | 604 KB | Output is correct |
16 | Correct | 82 ms | 632 KB | Output is correct |
17 | Correct | 79 ms | 548 KB | Output is correct |
18 | Correct | 92 ms | 636 KB | Output is correct |
19 | Correct | 56 ms | 512 KB | Output is correct |
20 | Correct | 95 ms | 620 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4 ms | 384 KB | Time limit exceeded (wall clock) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 512 KB | Output is correct |
2 | Correct | 3 ms | 512 KB | Output is correct |
3 | Correct | 3 ms | 512 KB | Output is correct |
4 | Correct | 2 ms | 512 KB | Output is correct |
5 | Correct | 2 ms | 512 KB | Output is correct |
6 | Correct | 3 ms | 512 KB | Output is correct |
7 | Correct | 3 ms | 512 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 78 ms | 548 KB | Output is correct |
12 | Correct | 72 ms | 632 KB | Output is correct |
13 | Correct | 75 ms | 632 KB | Output is correct |
14 | Correct | 71 ms | 632 KB | Output is correct |
15 | Correct | 79 ms | 604 KB | Output is correct |
16 | Correct | 82 ms | 632 KB | Output is correct |
17 | Correct | 79 ms | 548 KB | Output is correct |
18 | Correct | 92 ms | 636 KB | Output is correct |
19 | Correct | 56 ms | 512 KB | Output is correct |
20 | Correct | 95 ms | 620 KB | Output is correct |
21 | Execution timed out | 4 ms | 384 KB | Time limit exceeded (wall clock) |
22 | Halted | 0 ms | 0 KB | - |