제출 #660943

#제출 시각아이디문제언어결과실행 시간메모리
660943urosk전선 연결 (IOI17_wiring)C++14
13 / 100
23 ms5324 KiB
#include "wiring.h" #include <bits/stdc++.h> #define ll long long #define sz(a) (ll)(a.size()) #define pb push_back #define popb pop_back #define all(a) a.begin(),a.end() #define here cerr<<"===================================\n" #define endl '\n' #define ceri(a,l,r) {for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;} using namespace std; #define maxn 100005 ll n,m,ans; ll a[maxn],c[maxn]; long long min_total_length(vector<int> r, vector<int> b) { for(ll x : r) a[++n] = x; for(ll x : b) c[++m] = x; if(a[n]<c[1]){ reverse(all(r)); while(sz(r)>1&&sz(b)>1){ ans+=abs(r.back()-b.back()); r.popb(); b.popb(); } if(sz(r)<sz(b)) swap(r,b); for(ll x : r) ans+=abs(x-b[0]); return ans; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...