답안 #631927

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
631927 2022-08-19T07:33:21 Z Mahdi Sightseeing in Kyoto (JOI22_kyoto) C++17
10 / 100
8 ms 8216 KB
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(v) v.begin(), v.end()
#define F first
#define S second
typedef pair<int, int> pii;
typedef long long ll;
const int N=1e3+5;
int n, m, a[N], b[N];
ll dp[N][N];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n>>m;
    if(n>1000)
        return 0;
    for(int i=0;i<n;++i){
        cin>>a[i];
    }
    for(int i=0;i<m;++i){
        cin>>b[i];
    }
    for(int i=0;i<n;++i)
        fill(dp[i], dp[i]+m, 1e18);
    dp[0][0]=0;
    for(int i=0;i<n;++i){
        for(int j=0;j<m;++j){
            if(i>0)
                dp[i][j]=dp[i-1][j]+b[j];
            if(j>0)
                dp[i][j]=min(dp[i][j], dp[i][j-1]+a[i]);
        }
    }
    cout<<dp[n-1][m-1]<<'\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 2260 KB Output is correct
6 Correct 1 ms 1620 KB Output is correct
7 Correct 1 ms 1108 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 7 ms 8152 KB Output is correct
10 Correct 8 ms 8140 KB Output is correct
11 Correct 8 ms 8156 KB Output is correct
12 Correct 7 ms 8148 KB Output is correct
13 Correct 7 ms 8148 KB Output is correct
14 Correct 8 ms 8216 KB Output is correct
15 Correct 8 ms 8148 KB Output is correct
16 Correct 7 ms 8148 KB Output is correct
17 Correct 8 ms 8136 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 0 ms 328 KB Output is correct
26 Correct 0 ms 328 KB Output is correct
27 Correct 0 ms 340 KB Output is correct
28 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Incorrect 3 ms 2764 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 2260 KB Output is correct
6 Correct 1 ms 1620 KB Output is correct
7 Correct 1 ms 1108 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 7 ms 8152 KB Output is correct
10 Correct 8 ms 8140 KB Output is correct
11 Correct 8 ms 8156 KB Output is correct
12 Correct 7 ms 8148 KB Output is correct
13 Correct 7 ms 8148 KB Output is correct
14 Correct 8 ms 8216 KB Output is correct
15 Correct 8 ms 8148 KB Output is correct
16 Correct 7 ms 8148 KB Output is correct
17 Correct 8 ms 8136 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 0 ms 328 KB Output is correct
26 Correct 0 ms 328 KB Output is correct
27 Correct 0 ms 340 KB Output is correct
28 Correct 0 ms 340 KB Output is correct
29 Correct 0 ms 340 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Incorrect 3 ms 2764 KB Output isn't correct
32 Halted 0 ms 0 KB -