# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
119977 |
2019-06-22T20:19:01 Z |
Lawliet |
Aliens (IOI16_aliens) |
C++14 |
|
231 ms |
200164 KB |
#include <bits/stdc++.h>
#include "aliens.h"
#define X first
#define Y second
#define MAXK 510
#define MAXN 50010
#define INF 1000000000000000000LL
using namespace std;
typedef long long int lli;
typedef pair<lli,lli> pii;
lli N, M, K;
lli dp[MAXN][MAXK];
vector<pii> points;
lli cost(int i, int j)
{
lli dif = points[i].X - points[j].X + 1;
return dif*dif;
}
lli DP(int i, int k)
{
if(dp[i][k] != -1) return dp[i][k];
if(i == 0) return dp[i][k] = 0;
if(k == 0) return dp[i][k] = INF;
dp[i][k] = INF;
for(int g = 1 ; g <= i ; g++)
dp[i][k] = min(dp[i][k] , DP(g - 1 , k - 1) + cost(i , g));
return dp[i][k];
}
long long int take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c)
{
N = n; M = m; K = k;
memset(dp , -1 , sizeof(dp));
points.push_back({-1 , -1});
for(int g = 0 ; g < n ; g++)
points.push_back({c[g] , r[g]});
sort(points.begin(),points.end());
return DP(n , k);
}
/*int main()
{
int nn, mm, kk;
int n1, n2;
scanf("%d %d %d",&nn,&mm,&kk);
vector<int> xx, yy;
for(int g = 0 ; g < nn ; g++)
{
scanf("%d %d",&n1,&n2);
xx.push_back(n1);
yy.push_back(n2);
}
printf("%lld\n",take_photos(nn , mm , kk , xx , yy));
}*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
147 ms |
199916 KB |
Wrong answer: output = 1, expected = 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
144 ms |
199968 KB |
Correct answer: answer = 1 |
2 |
Correct |
143 ms |
199952 KB |
Correct answer: answer = 4 |
3 |
Correct |
145 ms |
199988 KB |
Correct answer: answer = 1 |
4 |
Correct |
148 ms |
199928 KB |
Correct answer: answer = 5 |
5 |
Correct |
144 ms |
199972 KB |
Correct answer: answer = 41 |
6 |
Correct |
147 ms |
199976 KB |
Correct answer: answer = 71923 |
7 |
Correct |
142 ms |
199948 KB |
Correct answer: answer = 77137 |
8 |
Correct |
214 ms |
199940 KB |
Correct answer: answer = 764 |
9 |
Correct |
144 ms |
200020 KB |
Correct answer: answer = 250000 |
10 |
Correct |
225 ms |
200164 KB |
Correct answer: answer = 500 |
11 |
Correct |
153 ms |
200000 KB |
Correct answer: answer = 32 |
12 |
Correct |
150 ms |
199928 KB |
Correct answer: answer = 130050 |
13 |
Correct |
164 ms |
199928 KB |
Correct answer: answer = 5110 |
14 |
Correct |
149 ms |
199924 KB |
Correct answer: answer = 2626 |
15 |
Correct |
154 ms |
199928 KB |
Correct answer: answer = 796 |
16 |
Correct |
163 ms |
199928 KB |
Correct answer: answer = 7580 |
17 |
Correct |
195 ms |
200060 KB |
Correct answer: answer = 1904 |
18 |
Correct |
149 ms |
200032 KB |
Correct answer: answer = 996004 |
19 |
Correct |
155 ms |
200008 KB |
Correct answer: answer = 38817 |
20 |
Correct |
199 ms |
200032 KB |
Correct answer: answer = 4096 |
21 |
Correct |
144 ms |
199920 KB |
Correct answer: answer = 1 |
22 |
Correct |
231 ms |
199988 KB |
Correct answer: answer = 1 |
23 |
Correct |
185 ms |
200000 KB |
Correct answer: answer = 2040 |
24 |
Correct |
223 ms |
200052 KB |
Correct answer: answer = 2 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
147 ms |
199916 KB |
Wrong answer: output = 1, expected = 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
147 ms |
199916 KB |
Wrong answer: output = 1, expected = 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
147 ms |
199916 KB |
Wrong answer: output = 1, expected = 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
147 ms |
199916 KB |
Wrong answer: output = 1, expected = 4 |
2 |
Halted |
0 ms |
0 KB |
- |