제출 #660601

#제출 시각아이디문제언어결과실행 시간메모리
660601Trisanu_Das전선 연결 (IOI17_wiring)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long llo; #define mp make_pair #define pb push_back #define a first #define b second //#define endl '\n' #include "wiring.h" llo dp[200001]; llo dp2[200001]; long long min_total_length(std::vector<int> r, std::vector<int> b) { vector<pair<int,int>> ss; int n=r.size(); int m=b.size(); for(llo i=0;i<n;i++)ss.pb({r[i],0}); for(llo i=0;i<m;i++)ss.pb({b[i],1}); vector<vector<llo>> tt; sort(ss.begin(),ss.end()); int ind2=0; while(ind2<ss.size()){ int cur=ss[ind2].b; tt.pb({}); while(ind2<ss.size()){ if(ss[ind2].b==cur){ tt[tt.size()-1].pb(ss[ind2].a); ind2++; } elsebreak; } } for(llo i=0;i<=n+m;i++)dp[i]=1e18; dp[0]=0;; for(llo i=1;i<tt.size();i++){ for(llo j=0;j<=tt[i].size();j++)dp2[j]=1e18; vector<llo> mi; vector<llo> mi2; for(llo j=0;j<=tt[i-1].size();j++){ mi.pb((llo)1e18); mi2.pb((llo)1e18); } llo xx=tt[i-1].size(); llo su=0; llo ind=xx-1; for(llo j=0;j<=tt[i-1].size();j++){ if(j>0){ su+=tt[i-1][ind]; ind--; } mi[j]=min(mi[j],dp[xx-j]+tt[i-1].back()*j-su); if(j>0) mi[j]=min(mi[j-1],mi[j]); } ind=0; for(llo j=tt[i-1].size();j>=0;j--){ mi2[j]=min(mi2[j],dp[xx-j]-su+tt[i][0]*j); if(j<tt[i-1].size())mi2[j]=min(mi2[j],mi2[j+1]); if(j>0){ su-=tt[i-1][ind]; ind++; } } llo kk=0; for(llo j=0;j<=tt[i].size();j++){ if(j>0) kk+=tt[i][j-1]; dp2[j]=min(dp2[j],mi[min(j,(llo)xx)]-tt[i-1].back()*j+kk); if(j<=xx)dp2[j]=min(dp2[j],mi2[j]-tt[i][0]*j+kk); } for(llo j=0;j<=tt[i].size();j++) dp[j]=dp2[j]; } return dp[tt.back().size()]; }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:24:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  while(ind2<ss.size()){
      |        ~~~~^~~~~~~~~~
wiring.cpp:27:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   while(ind2<ss.size()){
      |         ~~~~^~~~~~~~~~
wiring.cpp:32:4: error: 'elsebreak' was not declared in this scope
   32 |    elsebreak;
      |    ^~~~~~~~~
wiring.cpp:37:15: warning: comparison of integer expressions of different signedness: 'llo' {aka 'long long int'} and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  for(llo i=1;i<tt.size();i++){
      |              ~^~~~~~~~~~
wiring.cpp:38:16: warning: comparison of integer expressions of different signedness: 'llo' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   for(llo j=0;j<=tt[i].size();j++)dp2[j]=1e18;
      |               ~^~~~~~~~~~~~~~
wiring.cpp:41:16: warning: comparison of integer expressions of different signedness: 'llo' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |   for(llo j=0;j<=tt[i-1].size();j++){
      |               ~^~~~~~~~~~~~~~~~
wiring.cpp:48:16: warning: comparison of integer expressions of different signedness: 'llo' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |   for(llo j=0;j<=tt[i-1].size();j++){
      |               ~^~~~~~~~~~~~~~~~
wiring.cpp:59:8: warning: comparison of integer expressions of different signedness: 'llo' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |    if(j<tt[i-1].size())mi2[j]=min(mi2[j],mi2[j+1]);
      |       ~^~~~~~~~~~~~~~~
wiring.cpp:66:16: warning: comparison of integer expressions of different signedness: 'llo' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |   for(llo j=0;j<=tt[i].size();j++){
      |               ~^~~~~~~~~~~~~~
wiring.cpp:71:16: warning: comparison of integer expressions of different signedness: 'llo' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |   for(llo j=0;j<=tt[i].size();j++) dp[j]=dp2[j];
      |               ~^~~~~~~~~~~~~~