Submission #130586

#TimeUsernameProblemLanguageResultExecution timeMemory
130586redaWiring (IOI17_wiring)C++14
0 / 100
2 ms376 KiB
#include<bits/stdc++.h> #include "wiring.h" #define ll long long using namespace std ; ll min_total_length(vector<int> r, vector<int> b) { ll sr = r.size(); ll sb = b.size(); sort(r.begin(),r.end()); sort(b.begin(),b.end()); ll c=0; for(int i=0;i<min(sr,sb);i++) { c+=abs(r[i%sr]-b[i%sb]); } if(sb<sr){ for(int i = sb ;i<sr;i++ ) c+=abs(r[sr-1]-b[i]); } else for(int i = sr ;i<sb;i++ ) c+=abs(b[sb-1]-r[i]); return c; }
#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...