Submission #755537

#TimeUsernameProblemLanguageResultExecution timeMemory
755537PanosPaskWiring (IOI17_wiring)C++14
0 / 100
1 ms304 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; int n, m; long long min_total_length(std::vector<int> r, std::vector<int> b) { n = r.size(); m = b.size(); if (r.back() < b.front()) { ll ans = 0; int rfocal = r.back(); int bfocal = b.front(); int i = 0; while (i < n && i < m) { int rpoint = r[n - 1 - i]; int bpoint = b[i]; ans += abs(rpoint - bpoint); i++; } for (int cur = i; cur < n; cur++) { ans += abs(r[n - 1 - i] - bfocal); } for (int cur = i; cur < m; cur++) { ans += abs(b[i] - rfocal); } return ans; } return -1; }
#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...