Submission #406708

#TimeUsernameProblemLanguageResultExecution timeMemory
406708wiwihoWiring (IOI17_wiring)C++14
13 / 100
31 ms1848 KiB
#include "wiring.h" #include<bits/stdc++.h> #define printv(a, b) { \ for(auto pv : a) b << pv << " "; \ b << "\n"; \ } #define mp make_pair #define F first #define S second #define iter(a) a.begin(), a.end() #define lsort(a) sort(iter(a)) #define eb emplace_back using namespace std; typedef long long ll; using pii = pair<int, int>; const ll MAX = 1LL << 60; ostream& operator<<(ostream& o, pii p){ return o << '(' << p.F << ',' << p.S << ')'; } ll min_total_length(vector<int> r, vector<int> b) { int n = r.size(), m = b.size(); assert(r.back() < b.front()); ll ans = 0; if(n >= m){ for(int i : r) ans += b.front() - i; for(int i : b) ans += i - b.front(); } else{ for(int i : r) ans += r.back() - i; for(int i : b) ans += i - r.back(); } return ans; }
#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...