Submission #931668

# Submission time Handle Problem Language Result Execution time Memory
931668 2024-02-22T08:36:19 Z Aiperiii Wiring (IOI17_wiring) C++14
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
#include "wiring.h"
#define ll long long
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
using namespace std;
const int N=205;
ll dp[N][N];
long long min_total_length(vector<int> r,vector<int> b) {
    int n=r.size(),m=b.size();
    ll ans=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];
}
/*signed main(){
    ios_base::sync_with_stdio();
    cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    vector <int> a(n),b(m);
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<m;i++)cin>>b[i];
    cout<<min_total_length(a,b);
}*/
/*
 
 */

Compilation message

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:13:8: warning: unused variable 'ans' [-Wunused-variable]
   13 |     ll ans=0;
      |        ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 3rd lines differ - on the 1st token, expected: '25859', found: '21828'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 3rd lines differ - on the 1st token, expected: '904', found: '326'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 3rd lines differ - on the 1st token, expected: '316', found: '188'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 3rd lines differ - on the 1st token, expected: '27', found: '19'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 3rd lines differ - on the 1st token, expected: '25859', found: '21828'
2 Halted 0 ms 0 KB -