Submission #47248

#TimeUsernameProblemLanguageResultExecution timeMemory
47248dqhungdlWiring (IOI17_wiring)C++17
7 / 100
41 ms7276 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; int64_t m=0,n=0,a[100005],b[100005],f[205][205]; int64_t Sub1() { for(int64_t i=1;i<=m;i++) f[i][0]=1e15; for(int64_t i=1;i<=n;i++) f[0][i]=1e15; for(int64_t i=1;i<=m;i++) for(int64_t j=1;j<=n;j++) f[i][j]=min(min(f[i-1][j],f[i][j-1]),f[i-1][j-1])+abs(a[i]-b[j]); return f[m][n]; } long long min_total_length(vector<int> A,vector<int> B) { for(int64_t i=0;i<A.size();i++) a[++m]=A[i]; for(int64_t i=0;i<B.size();i++) b[++n]=B[i]; if(m<=200&&n<=200) return Sub1(); } /*int main() { ios_base::sync_with_stdio(false); freopen("TEST.INP","r",stdin); int64_t mm,nn,x; vector<int> A,B; cin>>mm>>nn; while(mm--) { cin>>x; A.push_back(x); } while(nn--) { cin>>x; B.push_back(x); } cout<<min_total_length(A,B); }*/

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:21:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int64_t i=0;i<A.size();i++)
                     ~^~~~~~~~~
wiring.cpp:23:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int64_t i=0;i<B.size();i++)
                     ~^~~~~~~~~
wiring.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#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...