답안 #836034

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
836034 2023-08-24T05:52:57 Z josanneo22 Sightseeing in Kyoto (JOI22_kyoto) C++17
10 / 100
589 ms 1048576 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ld long double
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define ar array

const int inf = 1e18;
void solve() {
    int h, w; cin >> h >> w;
    vector<int> ch(h), cv(w);
    for (int i = 0; i < h; i++) cin >> ch[i];
    for (int i = 0; i < w; i++) cin >> cv[i];
    using node = pair<int, pair<int, int>>;
    vector<vector<int>> dis(h, vector<int>(w,inf));
    priority_queue<node, vector<node>, greater<node>> pq;
    pq.push(mp(0, mp(0, 0)));
    while (pq.size()) {
        node p = pq.top(); pq.pop();
        int x = p.second.first, y = p.second.second, pp = p.first;
        if (dis[x][y] <= pp) continue;
        dis[x][y] = pp;
        if (x + 1 < h) pq.push(mp(pp + cv[y], mp(x + 1, y)));
        if (y + 1 < w) pq.push(mp(pp + ch[x], mp(x, y + 1)));
    }
    cout << dis[h - 1][w - 1] << '\n';
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 9 ms 724 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 344 ms 14480 KB Output is correct
10 Correct 353 ms 14444 KB Output is correct
11 Correct 248 ms 9108 KB Output is correct
12 Correct 240 ms 9040 KB Output is correct
13 Correct 223 ms 8716 KB Output is correct
14 Correct 228 ms 8724 KB Output is correct
15 Correct 222 ms 8672 KB Output is correct
16 Correct 214 ms 8404 KB Output is correct
17 Correct 176 ms 8268 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 320 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 256 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 85 ms 3732 KB Output is correct
4 Runtime error 589 ms 1048576 KB Execution killed with signal 9
5 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 212 KB Output is correct
4 Correct 9 ms 724 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 344 ms 14480 KB Output is correct
10 Correct 353 ms 14444 KB Output is correct
11 Correct 248 ms 9108 KB Output is correct
12 Correct 240 ms 9040 KB Output is correct
13 Correct 223 ms 8716 KB Output is correct
14 Correct 228 ms 8724 KB Output is correct
15 Correct 222 ms 8672 KB Output is correct
16 Correct 214 ms 8404 KB Output is correct
17 Correct 176 ms 8268 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 320 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 256 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 85 ms 3732 KB Output is correct
32 Runtime error 589 ms 1048576 KB Execution killed with signal 9
33 Halted 0 ms 0 KB -