| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 286442 | peti1234 | 전선 연결 (IOI17_wiring) | C++17 | 61 ms | 6648 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int c=200002;
long long n, kom[c], dp[c], el=1, veg, o=0;
pair<int, int> a[c];
long long min_total_length(std::vector<int> r, std::vector<int> b) {
for (int i=0; i<r.size(); i++) {
n++;
a[n]={r[i], 0};
}
for (int i=0; i<b.size(); i++) {
n++;
a[n]={b[i], 1};
}
sort(a+1, a+n+1);
for (int i=1; i<=n; i++) {
kom[i]=kom[i-1]+a[i].first;
}
a[0]={-1e9-7, !a[1].second};
for (int i=1; i<=n; i++) {
while(veg<n && a[veg+1].second==a[i].second) veg++;
for (int k=el; k<i; k++) dp[k]=min(dp[k], dp[k-1]+a[i].first-a[k].first);
long long s=dp[i-1], v=0;
for (int k=i; k<=veg; k++) {
v+=a[k].first-a[i-1].first;
long long db=k-i+1;
if (db<=i-el) s=min(s, dp[max(o, i-db-1)]+db*a[i-1].first-kom[i-1]+kom[max(o, i-db-1)]);
dp[k]=s+v;
}
el=i, i=veg;
}
return dp[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... | ||||
