#include "aliens.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) {
vector<bool> v(m+1, false);
vector<vector<ll>> dp(n+1, vector<ll> (k+1, n*n+10));
ll i, j;
for(i=0; i<n; i++){
r[i]++;
v[r[i]]=true;
}
for(i=1; i<=m; i++){
if(v[i]){
break;
}
else{
for(ll j=0; j<=k; j++) dp[i][j]=0;
}
}
for(i=1; i<=m; i++){
if(!v[i]){
dp[i][1]=dp[i-1][1];
}
else {
dp[i][1]=(i-r[0]+1)*(i-r[0]+1);
}
}
for(i=1; i<=m; i++){
for(j=1; j<=k; j++){
if(!v[i]){
dp[i][j]=dp[i-1][j];
continue;
}
for(ll a: r){
if(a>v[i]){
break;
}
dp[i][j]=min(dp[i][j], dp[a-1][j-1]+(i-a+1)*(i-a+1));
}
}
}
return dp[n][k];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Correct answer: answer = 1 |
2 |
Correct |
0 ms |
212 KB |
Correct answer: answer = 4 |
3 |
Incorrect |
0 ms |
212 KB |
Wrong answer: output = 26, expected = 1 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |