Submission #410540

#TimeUsernameProblemLanguageResultExecution timeMemory
410540dreezyWiring (IOI17_wiring)C++17
0 / 100
1 ms288 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pi pair<int,int> #define pb push_back const int maxn = 1e5 + 5; ll min_total_length(vector<int> r, vector<int> b){ //for each point calculate the closest one //pair all the closest ones first ll ans = 0; int n = r.size(); int m = b.size(); vector<vector<ll>> dp(n+1, vector<ll>(m+1,0)); for(int i =1; i<= n; i++){ for(int j =1; j<= m; j++){ dp[i][j] = min({dp[i-1][j], dp[i][j-1], dp[i-1][j-1] }) + abs(r[i-1] - b[j-1]); } } return dp[n][m]; }

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:13:5: warning: unused variable 'ans' [-Wunused-variable]
   13 |  ll ans = 0;
      |     ^~~
#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...