Submission #738386

#TimeUsernameProblemLanguageResultExecution timeMemory
738386Elvin_FritlWiring (IOI17_wiring)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; #include "wiring.h" long long min_total_length(vector<int> r, vector<int> b){ set<int>s; for(int i=0;i<(int)r.size();i++){ s.insert(r[i]); } long long res=0; for(int i=0;i<(int)b.size();i++){ auto it=s.upper_bound(b[i]); auto it2=it; if(it!=s.begin()){ it2--; } int tmp=min(abs(*it - b[i]) , abs(*it2 - b[i])); res+=tmp; } return res; }
#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...