Submission #1034479

#TimeUsernameProblemLanguageResultExecution timeMemory
1034479ALeonidouWiring (IOI17_wiring)C++17
13 / 100
17 ms5468 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define sz(x) (ll)x.size() #define endl "\n" #define pb push_back #define F first #define S second typedef vector <ll> vi; typedef pair <ll,ll> ii; typedef vector <ii> vii; #define dbg(x) cout<<#x<<": "<<x<<endl; #define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl; #define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl; void printVct(vi &v){ for (ll i =0; i<sz(v); i++){ cout<<v[i]<<" "; } cout<<endl; } vi r, b; long long min_total_length(vector<int> R, vector<int> B) { ll n = sz(R), m = sz(B); r.resize(n), b.resize(m); for (ll i =0; i<n; i++){ r[i] = R[i]; } for (ll i = 0; i<m; i++){ b[i] = B[i]; } //subtask 2: reverse(r.begin(), r.end()); ll ans = 0; for (ll i =0; i<min(n,m); i++){ ans += abs(b[i] - r[i]); } if (n > m){ for (ll i =min(n,m); i<n; i++){ ans += abs(b[0]-r[i]); } } else if (m > n){ for (ll i =min(n,m); i<m; i++){ ans += abs(b[i]-r[0]); } } 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...