# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
476038 | AdamGS | Aliens (IOI16_aliens) | C++14 | 2075 ms | 204 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "aliens.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e5+7;
const ll INF=1e18+7;
vector<pair<ll,ll>>V;
ll dp[LIM], ile[LIM];
void licz(ll c) {
int n=V.size();
rep(i, n) {
dp[i]=ile[i]=INF;
rep(j, i+1) {
ll x=abs(V[i].nd-V[j].st)+1;
x=x*x+c;
if(j) {
x+=dp[j-1];
ll y=abs(V[i].st-V[j].nd)+1;
if(V[i].st>V[j].nd) x-=y*y;
}
if(x<dp[i]) {
dp[i]=x;
ile[i]=1;
if(j) ile[i]+=ile[j-1];
} else {
ll a=1;
if(j) a+=ile[j-1];
ile[i]=min(ile[i], a);
}
}
}
}
ll take_photos(int N, int M, int K, vector<int>r, vector<int>c) {
ll n=N, m=M, k=K;
vector<pair<int,int>>S;
rep(i, n) {
if(r[i]<=c[i]) S.pb({r[i], -c[i]});
else S.pb({c[i], -r[i]});
}
sort(all(S));
int ma=-1;
for(auto i : S) {
if(ma>=-i.nd) continue;
V.pb({i.st, -i.nd});
ma=max(ma, -i.nd);
}
ll po=0, ko=10000000000;
while(po<ko) {
ll sr=(po+ko)/2;
licz(sr);
if(ile[V.size()-1]<=k) ko=sr-0.01; else po=sr+0.01;
}
licz(po);
return dp[V.size()-1]-po*k;
}
컴파일 시 표준 에러 (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... |