제출 #420813

#제출 시각아이디문제언어결과실행 시간메모리
420813MDario전선 연결 (IOI17_wiring)C++11
7 / 100
146 ms262148 KiB
#include "wiring.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define F first #define S second long long min_total_length(vector<int> r, vector<int> b) { ll n=r.size(), m=b.size(); ll a[n+1], a1[m+1], dp[n+1][m+1]; for(int i=0; i<n; i++){ a[i]=r[i]; } for(int i=0; i<n; i++){ a[i]=r[i]; } dp[0][0]=abs(r[0]-b[0]); for(int i=0; i<n; i++){ for(int t=0; t<m; t++){ if(i==0&&t==0)continue; else if(i==0){ dp[i][t]=abs(r[i]-b[t])+dp[i][t-1]; } else if(t==0){ dp[i][t]=abs(r[i]-b[t])+dp[i-1][t]; } else{ dp[i][t]=abs(r[i]-b[t])+min(dp[i-1][t-1], min(dp[i-1][t], dp[i][t-1])); } } } 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:9:8: warning: variable 'a' set but not used [-Wunused-but-set-variable]
    9 |     ll a[n+1], a1[m+1], dp[n+1][m+1];
      |        ^
wiring.cpp:9:16: warning: unused variable 'a1' [-Wunused-variable]
    9 |     ll a[n+1], a1[m+1], 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...