제출 #1022939

#제출 시각아이디문제언어결과실행 시간메모리
1022939hirayuu_oj전선 연결 (IOI17_wiring)C++17
13 / 100
22 ms3148 KiB
#include "wiring.h" #include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) using ll=long long; long long min_total_length(std::vector<int> r, std::vector<int> b) { if(r.size()<=1000&&b.size()<=1000){ if(r.size()<b.size())swap(r,b); int n=r.size(); int m=b.size(); vector<ll> dp(m,1LL<<60); dp[0]=abs(r[0]-b[0]); for(int i=1; i<n; i++){ vector<ll> ndp(m,1LL<<60); rep(j,m){ ndp[j]=dp[j]; if(j!=0)ndp[j]=min(ndp[j],dp[j-1]); ndp[j]+=abs(r[i]-b[j]); } swap(dp,ndp); } return dp[m-1]; } else{ ll ans=0; rep(i,max(b.size(),r.size())){ ans+=abs(r[min((int)r.size()-1,i)]-b[max(0,(int)b.size()-1-i)]); } return ans; } }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:4:32: warning: comparison of integer expressions of different signedness: 'int' and 'const long unsigned int' [-Wsign-compare]
    4 | #define rep(i,n) for(int i=0; i<(n); i++)
      |                                ^
wiring.cpp:27:3: note: in expansion of macro 'rep'
   27 |   rep(i,max(b.size(),r.size())){
      |   ^~~
#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...