# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
30502 |
2017-07-24T08:23:09 Z |
zoomswk |
Aliens (IOI16_aliens) |
C++14 |
|
0 ms |
4796 KB |
#include "aliens.h"
#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> p;
int L[100005], R[100005];
long long dp[505][505];
long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c){
for(int i=0; i<n; i++) p.push_back({min(r[i], c[i]), -max(r[i], c[i])});
sort(p.begin(), p.end());
int N=1, tmp_mx=-1;
for(int i=0; i<n; i++){
if(-p[i].second > tmp_mx){
L[N] = p[i].first, R[N] = -p[i].second;
tmp_mx = -p[i].second;
N++;
}
}
N--;
for(int i=1; i<=N; i++){
dp[i][0] = 1e18;
for(int j=1; j<=k; j++){
dp[i][j] = 1e18;
for(int x=1; x<=i; x++){
dp[i][j] = min(dp[i][j], dp[x-1][j-1]+1LL*(R[i]-L[x]+1)*(R[i]-L[x]+1)-(j > 1 ? 1LL*(R[x-1]-L[x]+1)*(R[x-1]-L[x]+1): 0LL));
}
}
}
return dp[N][k];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
4796 KB |
Correct answer: answer = 4 |
2 |
Incorrect |
0 ms |
4796 KB |
Wrong answer: output = 3, expected = 4 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
4796 KB |
Correct answer: answer = 1 |
2 |
Correct |
0 ms |
4796 KB |
Correct answer: answer = 4 |
3 |
Incorrect |
0 ms |
4796 KB |
Wrong answer: output = 0, expected = 1 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
4796 KB |
Correct answer: answer = 4 |
2 |
Incorrect |
0 ms |
4796 KB |
Wrong answer: output = 3, expected = 4 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
4796 KB |
Correct answer: answer = 4 |
2 |
Incorrect |
0 ms |
4796 KB |
Wrong answer: output = 3, expected = 4 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
4796 KB |
Correct answer: answer = 4 |
2 |
Incorrect |
0 ms |
4796 KB |
Wrong answer: output = 3, expected = 4 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
4796 KB |
Correct answer: answer = 4 |
2 |
Incorrect |
0 ms |
4796 KB |
Wrong answer: output = 3, expected = 4 |
3 |
Halted |
0 ms |
0 KB |
- |