제출 #264042

#제출 시각아이디문제언어결과실행 시간메모리
264042arnold518전선 연결 (IOI17_wiring)C++14
13 / 100
55 ms3452 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 1e5; int N, M; ll A[MAXN+10], B[MAXN+10]; ll ans=0; ll min_total_length(vector<int> _A, vector<int> _B) { N=_A.size(); M=_B.size(); for(int i=1; i<=N; i++) A[i]=_A[i-1]; for(int i=1; i<=M; i++) B[i]=_B[i-1]; for(int i=1; i<N; i++) { ans+=(A[i+1]-A[i])*i; } for(int i=1; i<M; i++) { ans+=(B[i+1]-B[i])*(M-i); } ans+=(B[1]-A[N])*max(N, M); 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...