Submission #47247

#TimeUsernameProblemLanguageResultExecution timeMemory
47247dqhungdlWiring (IOI17_wiring)C++17
0 / 100
2 ms488 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++) 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:17:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int64_t i=0;i<A.size();i++)
                     ~^~~~~~~~~
wiring.cpp:19:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int64_t i=0;i<B.size();i++)
                     ~^~~~~~~~~
wiring.cpp:23: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...