Submission #416492

#TimeUsernameProblemLanguageResultExecution timeMemory
416492yanireWiring (IOI17_wiring)C++11
13 / 100
29 ms1856 KiB
#include <bits/stdc++.h>
using namespace std;
#include "wiring.h"

#define fin(i,s,n) for(auto i = s; i < n; ++i)
#define fine(i,s,n) for(auto i = s; i <= n; ++i)
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define all(x) (x).begin(),(x).end()
#define chkmin(a,b) a = min(a,b)
#define chkmax(a,b) a = max(a,b)
using stdvec = vector<int>;
#define int int64_t
using ii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vii = vector<ii>;
const int inf = 1e17;
#define sz(a) int((a).size())

long long min_total_length(stdvec r, stdvec b) {
    int n = r.size(), m = b.size();
    int X = r.back();
    int ans = 0;
    fin(i,0,n) ans += X-r[i];
    fin(i,0,m) ans += b[i]-X;
    if(n>m) ans += (n-m)*(b[0]-X);
    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...