# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1073477 | hasan2006 | Wiring (IOI17_wiring) | C++17 | 31 ms | 2396 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "wiring.h"
using namespace std;
#define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define rall(s) s.rbegin(),s.rend()
#define all(s) s.begin(),s.end()
#define pb push_back
#define se second
#define fi first
#define ll long long
#define ld long double
#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define yes cout<<"yes\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n"
#define no cout<<"no\n"
ll min_total_length(vector<int> a, vector<int> b){
a.pb(2e9);
b.pb(2e9);
deque<int>d1 , d2;
if(a.size() > b.size())
swap(a , b);
int f , l, r , i , j , x , y , n , m;
ll s = 0;
f = a.size() + b.size() - 2;
l = r= 0;
while(f--){
if(a[l] <= b[r]){
if(d2.size() > 0)
s += a[l] - d2.back() , d2.pop_back();
else
d1.pb(a[l]);
l++;
}else {
if(d1.size() > 0)
s += b[r] - d1.back() , d1.pop_back();
else
d2.pb(b[r]);
r++;
}
}
l = 0;
for(i = 0; i < d1.size(); i++){
while(b[l] < d1[i])
l++;
x = b[l] - d1[i];
if(l)
x = min(x ,d1[i] - b[l - 1]);
s += x;
}
l = 0;
for(i = 0; i < d2.size(); i++){
while(a[l] < d2[i])
l++;
x = a[l] - d2[i];
if(l)
x = min(x ,d2[i] - a[l - 1]);
s += x;
}
return s;
}
컴파일 시 표준 에러 (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... |