Submission #967387

# Submission time Handle Problem Language Result Execution time Memory
967387 2024-04-22T04:04:03 Z Pring Wombats (IOI13_wombats) C++17
12 / 100
60 ms 16728 KB
#include <bits/stdc++.h>
#ifndef MIKU
#include "wombats.h"
#endif
using namespace std;

#ifdef MIKU
string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif

#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
using ll = long long;
typedef pair<int, int> pii;

namespace {
    const int MXN = 25, MXM = 200;
    int n, m;
    int h[MXN][MXM], v[MXN][MXM];
    vector<pii> edge[MXN * MXM];
    int dis[MXN * MXM], ans[MXM][MXM];

    void build() {
        FOR(i, 0, n) FOR(j, 0, m - 1) {
            edge[i * m + j].push_back(mp(h[i][j], i * m + j + 1));
            edge[i * m + j + 1].push_back(mp(h[i][j], i * m + j));
        }
        FOR(i, 0, n - 1) FOR(j, 0, m) {
            edge[i * m + j].push_back(mp(v[i][j], (i + 1) * m + j));
        }
    }

    void DIJKSTRA(int sr) {
        fill(dis, dis + n * m, -1);
        priority_queue<pii, vector<pii>, greater<pii>> pq;
        pq.push(mp(0, sr));
        while (pq.size()) {
            auto [len, id] = pq.top();
            pq.pop();
            if (dis[id] != -1) continue;
            dis[id] = len;
            for (auto &[w, i] : edge[id]) {
                if (dis[i] != -1) continue;
                pq.push(mp(len + w, i));
            }
        }
    }
}

void init(int R, int C, int H[][200], int V[][200]) {
    n = R;
    m = C;
    FOR(i, 0, n) copy(H[i], H[i] + m - 1, h[i]);
    FOR(i, 0, n - 1) copy(V[i], V[i] + m, v[i]);
    build();
    FOR(i, 0, m) {
        DIJKSTRA(i);
        copy(dis + (n - 1) * m, dis + (n * m), ans[i]);
    }
}

void changeH(int P, int Q, int W) {
}

void changeV(int P, int Q, int W) {
}

int escape(int V1, int V2) {
    return ans[V1][V2];
}

#ifdef MIKU
int hh[MXN][MXM], vv[MXN][MXM];
void miku() {
    int nn, mm;
    cin >> nn >> mm;
    FOR(i, 0, nn) FOR(j, 0, mm - 1) cin >> hh[i][j];
    FOR(i, 0, nn - 1) FOR(j, 0, mm) cin >> vv[i][j];
    init(nn, mm, hh, vv);
    int ee;
    cin >> ee;
    while (ee--) {
        int t;
        cin >> t;
        if (t == 1) {
            int p, q, w;
            cin >> p >> q >> w;
            changeH(p, q, w);
        } else if (t == 2) {
            int p, q, w;
            cin >> p >> q >> w;
            changeV(p, q, w);
        } else {
            int v1, v2;
            cin >> v1 >> v2;
            cout << escape(v1, v2) << '\n';
        }
    }
}

int32_t main() {
    cin.tie(0) -> sync_with_stdio(false);
    cin.exceptions(cin.failbit);
    miku();
    return 0;
}
#endif

Compilation message

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
   15 |  int res;
      |      ^~~
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 9308 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 2 ms 2652 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 2 ms 2616 KB Output is correct
7 Correct 2 ms 2652 KB Output is correct
8 Correct 2 ms 2652 KB Output is correct
9 Correct 2 ms 2652 KB Output is correct
10 Correct 2 ms 2652 KB Output is correct
11 Correct 60 ms 4856 KB Output is correct
12 Correct 2 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 5212 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 16728 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 5224 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 5212 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -