제출 #1068662

#제출 시각아이디문제언어결과실행 시간메모리
1068662edogawa_something전선 연결 (IOI17_wiring)C++17
0 / 100
1089 ms7116 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pii; typedef vector<ll> vii; #define F first #define S second #define all(v) v.begin(),v.end() #define pb push_back const ll inf=1e18; ll ans,dp[2][17][17],n,m; vector<pii>v; long long min_total_length(std::vector<int> r, std::vector<int> b) { n=r.size(),m=b.size(); for(int i=0;i<n;i++) { v.pb({r[i],0}); } for(int i=0;i<m;i++) { v.pb({b[i],1}); } sort(all(v)); dp[0][0][0]=0; for(int j=0;j<=16;j++) for(int k=0;k<=16;k++) dp[0][j][k]=inf; dp[0][0][0]=0; for(int i=1;i<=v.size();i++) { for(int j=0;j<=16;j++) { for(int k=0;k<=16;k++) { if(v[i-1].S==1) { dp[i%2][j][k]=inf; for(int c=j;c>=1;c--) { dp[i%2][j][k]=min(dp[i%2][j][k],dp[(i-1)%2][j-c][k]-c*v[i-1].F); } for(int c=1;c<=16;c++) { if(k+c>16) break; dp[i%2][j][k]=min(dp[i%2][j][k],dp[(i-1)%2][j][k+c]+c*v[i-1].F); } } else { dp[i%2][j][k]=inf; for(int c=k;c>=1;c--) { dp[i%2][j][k]=min(dp[i%2][j][k],dp[(i-1)%2][j][k-c]-c*v[i-1].F); } for(int c=1;c<=16;c++) { if(j+c>16) break; dp[i%2][j][k]=min(dp[i%2][j][k],dp[(i-1)%2][j+c][k]+c*v[i-1].F); } } } } } return dp[(v.size())%2][0][0]; }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:28:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   for(int i=1;i<=v.size();i++) {
      |               ~^~~~~~~~~~
#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...