제출 #723046

#제출 시각아이디문제언어결과실행 시간메모리
723046nihaddhuseynli전선 연결 (IOI17_wiring)C++14
7 / 100
149 ms262144 KiB
#include "wiring.h" #include <bits/stdc++.h> typedef long long int ll; using namespace std; long long min_total_length(std::vector<int> r, std::vector<int> b) { ll n=r.size(); ll m=b.size(); ll ans=0,ans1=INT_MAX; long long int dp[n+1][m+1]; for(int i =0;i<=n;i++) { for(int j =0;j<=m;j++) { dp[i][j]=INT_MAX; } } for(int i =0;i<n;i++) { for(int j =0;j<m;j++) { if(i==0) { if(j==0) { dp[i][j]=0;; } else { dp[i][j]=dp[i][j-1]; } } else { dp[i][j] = dp[i-1][j]; if (j>0){ dp[i][j] = min({dp[i][j],dp[i][j-1],dp[i-1][j-1]}); } } if(dp[i][j]!=INT_MAX) { dp[i][j]+=abs(r[i]-b[j]); } } } return dp[n-1][m-1]; }

컴파일 시 표준 에러 (stderr) 메시지

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