Submission #254064

# Submission time Handle Problem Language Result Execution time Memory
254064 2020-07-29T09:45:30 Z Erkhemkhuu Sky Walking (IOI19_walk) C++17
0 / 100
58 ms 8056 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
const ll N = 105;
typedef vector <int> vi;
bool vis[N][N];
vector <pair <int, int> > adj[N][N];
int min_distance(vi x, vi h, vi l, vi r, vi y, int s, int g) {
    int n, m, i, j;
    n = x.size(); m = l.size();
    for(i = 0; i < n; i++) {
        for(j = h[i]; j >= 1; j--) {
            adj[x[i]][j].pb(mp(x[i], j - 1));
            adj[x[i]][j - 1].pb(mp(x[i], j));
        }
    }
    for(i = 0; i < m; i++) {
        for(j = x[l[i]] + 1; j <= x[r[i]]; j++) {
            adj[j][y[i]].pb(mp(j - 1, y[i]));
            adj[j - 1][y[i]].pb(mp(j, y[i]));
        }
    }
    queue <pair <pair <int, int>, int> > q;
    q.push(mp(mp(x[s], 0), 0));
    while(!q.empty()) {
        auto v = q.front();
        q.pop();
        if(v.F.F == x[g] && !v.F.S) return v.S;
        if(vis[v.F.F][v.F.S]) continue;
        vis[v.F.F][v.F.S] = true;
        for(auto &to: adj[v.F.F][v.F.S]) {
            if(vis[to.F][to.S]) continue;
            q.push(mp(mp(to.F, to.S), v.S + 1));
        }
    }
    return -1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 0 ms 512 KB Output is correct
3 Runtime error 1 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Runtime error 58 ms 8056 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 20 ms 3584 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 20 ms 3584 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 0 ms 512 KB Output is correct
3 Runtime error 1 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -