이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "aliens.h"
#include <bits/stdc++.h>
using namespace std;
#define scd(t) scanf("%d", &t)
#define sclld(t) scanf("%lld", &t)
#define forr(i, j, k) for (int i = j; i < k; i++)
#define frange(i, j) forr(i, 0, j)
#define all(cont) cont.begin(), cont.end()
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef long long int lli;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<lli> vll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mpii;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef long double ld;
long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) {
vi val(m);
frange(i, n) {
int id = max(r[i], c[i]);
val[id] = max(val[id], id-min(r[i], c[i])+1);
}
vector<vll> dp(m, vll(k+1, 1e17));
if(val[0]) {
forr(i, 1, k+1) dp[0][i] = 1;
}
else {
frange(i, k+1) dp[0][i] = 0;
}
forr(i, 1, m) {
forr(j, 1, k+1) {
dp[i][j] = dp[i][j-1];
lli c = (lli)val[i];
for(lli l=1; i-l>=0; l++) {
if(val[i-l]+l>c) {
dp[i][j] = min(dp[i][j], 2*c*min(l, c)-min(l, c) * min(l, c) + dp[i-l][j-1]);
c = val[i-l] + l;
}
// dp[i][j] = max(dp[i][j], )
}
dp[i][j] = min(dp[i][j], c*c);
}
}
return dp[m-1][k];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |