Submission #453765

#TimeUsernameProblemLanguageResultExecution timeMemory
453765ak2006Wiring (IOI17_wiring)C++14
7 / 100
145 ms262148 KiB
#include <bits/stdc++.h> //#include "wiring.h" using namespace std; using ll = long long; using vb = vector<bool>; using vvb = vector<vb>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using vc = vector<char>; using vvc = vector<vc>; using vs = vector<string>; const ll mod = 1e9 + 7,inf = 1e18; #define pb push_back #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); ll min_total_length(vi a,vi b) { int n = (int)a.size(),m = (int)b.size(); vvl dp(n,vl(m)); for (int i = 0;i<n;i++){ for (int j = 0;j<m;j++){ if (i == 0 && j == 0){dp[i][j] = abs(a[i] - b[j]);continue;} dp[i][j] = 1ll * abs(1ll * a[i] - 1ll * b[j]) + min( { i >= 1 && j >= 1? dp[i - 1][j - 1] : inf, i >= 1 ? dp[i - 1][j] : inf, j >= 1 ? dp[i][j - 1] : inf } ); } } return dp[n - 1][m - 1]; }
#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...