#include "aliens.h"
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define vi vector<int>
#define vll vector<ll>
#define ll long long
using namespace std;
const int tam=505;
int N;
ll dp[tam][tam];
vi v;
ll f(int pos, int k){
if(pos==N)return 0;
if(k==0)return 1e6;
if(dp[pos][k]!=-1)return dp[pos][k];
dp[pos][k]=1e16;
for(int i=pos;i<N;i++){
ll tam=v[i]-v[pos]+1;
dp[pos][k]=min(dp[pos][k],tam*tam+f(i+1,k-1));
}
return dp[pos][k];
}
void init(){
for(int i=0;i<tam;i++){
for(int l=0;l<tam;l++){
dp[i][l]=-1;
}
}
}
long long take_photos(int n, int m, int k,vi r,vi c){
sort(r.begin(),r.end());
N=n;
v=r;
init();
return f(0,min(k,n));
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2252 KB |
Wrong answer: output = 1, expected = 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2252 KB |
Correct answer: answer = 1 |
2 |
Correct |
1 ms |
2252 KB |
Correct answer: answer = 4 |
3 |
Correct |
1 ms |
2252 KB |
Correct answer: answer = 1 |
4 |
Correct |
1 ms |
2252 KB |
Correct answer: answer = 5 |
5 |
Correct |
1 ms |
2252 KB |
Correct answer: answer = 41 |
6 |
Correct |
1 ms |
2252 KB |
Correct answer: answer = 71923 |
7 |
Correct |
3 ms |
2252 KB |
Correct answer: answer = 77137 |
8 |
Correct |
171 ms |
2252 KB |
Correct answer: answer = 764 |
9 |
Correct |
2 ms |
2252 KB |
Correct answer: answer = 250000 |
10 |
Correct |
165 ms |
2316 KB |
Correct answer: answer = 500 |
11 |
Correct |
1 ms |
2252 KB |
Correct answer: answer = 32 |
12 |
Correct |
2 ms |
2252 KB |
Correct answer: answer = 130050 |
13 |
Correct |
44 ms |
2252 KB |
Correct answer: answer = 5110 |
14 |
Correct |
7 ms |
2252 KB |
Correct answer: answer = 2626 |
15 |
Correct |
16 ms |
2252 KB |
Correct answer: answer = 796 |
16 |
Correct |
30 ms |
2252 KB |
Correct answer: answer = 7580 |
17 |
Correct |
117 ms |
2252 KB |
Correct answer: answer = 1904 |
18 |
Correct |
2 ms |
2252 KB |
Correct answer: answer = 996004 |
19 |
Correct |
20 ms |
2292 KB |
Correct answer: answer = 38817 |
20 |
Correct |
80 ms |
2252 KB |
Correct answer: answer = 4096 |
21 |
Correct |
1 ms |
2252 KB |
Correct answer: answer = 1 |
22 |
Correct |
166 ms |
2308 KB |
Correct answer: answer = 1 |
23 |
Correct |
94 ms |
2280 KB |
Correct answer: answer = 2040 |
24 |
Correct |
170 ms |
2308 KB |
Correct answer: answer = 2 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2252 KB |
Wrong answer: output = 1, expected = 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2252 KB |
Wrong answer: output = 1, expected = 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2252 KB |
Wrong answer: output = 1, expected = 4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2252 KB |
Wrong answer: output = 1, expected = 4 |
2 |
Halted |
0 ms |
0 KB |
- |