Submission #631412

# Submission time Handle Problem Language Result Execution time Memory
631412 2022-08-18T05:53:56 Z Darren0724 Jail (JOI22_jail) C++17
0 / 100
0 ms 212 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define rz resize
#define pb emplace_back
int INF=1e18;
int mod=1e9+7;

signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n,m;
  cin>>n>>m;
  vector<int> v(n+1),w(m+1);
  for(int i=1;i<=n;i++){
    cin>>v[i];
  }
  for(int i=1;i<=m;i++){
    cin>>w[i];
  }
  vector<vector<int>> dp(n+1,vector<int>(m+1,INF));
  dp[1][1]=0;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
      if(i==1&&j==1){
        continue;
      }
      dp[i][j]=min(dp[i-1][j]+w[j],dp[i][j-1]+v[i]);
    }
  }
  cout<<dp[n][m]<<endl;

  return 0;
}

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -