Submission #1021421

#TimeUsernameProblemLanguageResultExecution timeMemory
1021421MarwenElarbiWiring (IOI17_wiring)C++17
13 / 100
18 ms3920 KiB
#include <bits/stdc++.h> #include "wiring.h" #include <cassert> #include <cstdio> using namespace std; long long min_total_length(std::vector<int> r, std::vector<int> b){ int n=r.size(); int m=b.size(); //cout <<n<<" "<<m<<endl; long long ans=0; if(n<m){ for (int i = m-1; i > n-1; --i) { ans+=abs(b[i]-r[n-1]); } for (int i = n-1; i >= 0; --i) { ans+=abs(b[i]-r[i]); } }else{ for (int i = n-1; i > m-1; --i) { ans+=abs(b[0]-r[i]); } for (int i = m-1; i >=0 ; --i) { ans+=abs(b[i]-r[i]); } } 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...