이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}*/
컴파일 시 표준 에러 (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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |