| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 124875 | nvmdava | Aliens (IOI16_aliens) | C++17 | 2045 ms | 6376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "aliens.h"
#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v, t;
long long dp[2][100005];
long long cost(int l, int r){
l++;
if(l > r) return 0;
long long t1 = v[r].second - v[l].first;
long long t2 = max(0, v[l - 1].second - v[l].first);
return t1 * t1 - t2 * t2;
}
void opt(int id, int l, int r, int optl, int optr){
if(l > r) return;
int m = (l + r) >> 1;
dp[id][m] = 0x3f3f3f3f3f3f3f3f;
int optm;
for(int o = optl; o <= min(m, optr); o++){
long long c = cost(o, m);
if(dp[id][m] >= dp[id ^ 1][o] + c){
dp[id][m] = dp[id ^ 1][o] + c;
optm = o;
}
}
opt(id, l, m - 1, optl, optm);
opt(id, m + 1, r, optm, optr);
}
long long take_photos(int n, int m, int k, vector<int> r, vector<int> c){
for(int i = 0; i < n; i++)
t.push_back({min(r[i], c[i]), max(c[i], r[i]) + 1});
sort(t.begin(), t.end());
int mx = -1;
v.push_back({-1, -1});
for(auto& x : t)
if(x.second > mx)
v.push_back({x.first, mx = x.second});
n = v.size() - 1;
k = min(k, n);
memset(dp, 0x3f3f, sizeof dp);
dp[0][0] = 0;
for(int i = 1; i <= k; i++){
opt(i & 1, 0, n, 0, n);
}
return dp[k & 1][n];
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
