제출 #574606

#제출 시각아이디문제언어결과실행 시간메모리
574606definitelynotmee전선 연결 (IOI17_wiring)C++98
13 / 100
27 ms3768 KiB
#include<bits/stdc++.h>
#include"wiring.h"
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T>
using matrix = vector<vector<T>>;


long long min_total_length(std::vector<int> r, std::vector<int> b) {
    int n = r.size(), m = b.size();
    ll resp = 0;
    for(int i = 0; i < n; i++)
        resp-=r[i];
    for(int i = 0; i < m; i++)
        resp+=b[i];
    while(n > m){
        resp+=b[0];
        n--;
    }
    while(m > n){
        resp-=r.back();
        m--;
    }
	return resp;
}
//3 + 6 + 9 + 7 = 9 + 16 = 25
#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...