Submission #612524

#TimeUsernameProblemLanguageResultExecution timeMemory
612524MohamedAliSaidane전선 연결 (IOI17_wiring)C++14
13 / 100
27 ms3884 KiB
#include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef double ld;
    typedef pair<int,int> pii;
    typedef pair<ll,ll> pll;

    typedef vector<int> vi;
    typedef vector<ll> vll;
    typedef vector<pii> vpi;
    typedef vector<pll> vpl;

    #define pb push_back
    #define popb pop_back
    #define all(x) (x).begin(),(x).end()

    #define ff first
    #define ss second


    int n, m;
    ll min_total_length(vi r, vi b)
    {
        n = r.size(), m = b.size();
        sort(all(r));
        sort(all(b));
        int i= 0, j = 0 ;
        ll ans=  0ll;
        while(i < n || j < m)
        {
            if(i == n)
                ans += b[j++] - r[i - 1];
            else if(j == m)
                ans += b[0] - r[i++];
            else
                ans += b[j++] - 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...