# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
774731 | Tony1234 | Wiring (IOI17_wiring) | C++17 | 27 ms | 3800 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define pb push_back
#define vt vector
#define vi vector<int>
#define vll vector<ll>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define ub upper_bound
#define lb lower_bound
const int inf = (int)2e9, mod = (int)1e9 + 7, mx = (int)2e5 + 10;
const ll infll = (ll)7e18;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
long long min_total_length(std::vector<int> r, std::vector<int> b){
sort(r.begin(), r.end()); sort(b.begin(), b.end());
ll sum = 0;
for(int i = 0; i < min(r.size(), b.size()); i++)sum += b[i] - r[i];
if(r.size() > b.size()){
for(int i = b.size(); i < r.size(); i++)sum += b[0] - r[i];
}else{
for(int i = r.size(); i < b.size(); i++)sum += b[i] - r.back();
}
return sum;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |