제출 #1043048

#제출 시각아이디문제언어결과실행 시간메모리
1043048YassirSalama전선 연결 (IOI17_wiring)C++17
0 / 100
0 ms424 KiB
#include "wiring.h" #include<bits/stdc++.h> using namespace std; const int maxn=300; long long dp[maxn][maxn]; long long cost(long long a,long long b){ return max(a,b)-min(a,b); } long long min_total_length(vector<int> r, vector<int> b) { long long ans=0; int n=r.size(); int m=b.size(); int i=0; int j=0; while(i<n&&j<m){ ans+=b[j]-r[i]; if(i==n-1&&j==m-1) break; if(i+1<n) i++; if(j+1<m) j++; } return ans; } #ifdef IOI #include "wiring.h" #include <cassert> #include <cstdio> using namespace std; int main() { int n, m; assert(2 == scanf("%d %d", &n, &m)); vector<int> r(n), b(m); for(int i = 0; i < n; i++) assert(1 == scanf("%d", &r[i])); for(int i = 0; i < m; i++) assert(1 == scanf("%d", &b[i])); long long res = min_total_length(r, b); printf("%lld\n", res); return 0; } #endif
#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...