Submission #981075

# Submission time Handle Problem Language Result Execution time Memory
981075 2024-05-12T18:58:13 Z Abito Swapping Cities (APIO20_swap) C++17
0 / 100
2000 ms 38212 KB
#include "swap.h"
#include <bits/stdc++.h>
#define F first
#define S second
#define ep insert
#define pb push_back
using namespace std;
const int NN=1e3+5;
int n,m,dis[NN][NN];
vector<pair<int,int>> adj[NN];
bool vis[NN][NN];
void dijkstra(int X,int Y){
    memset(dis,-1,sizeof(dis));
    memset(vis,0,sizeof(vis));
    dis[X][Y]=0;
    priority_queue<vector<int>> pq;
    pq.push({0,X,Y});
    while (!pq.empty()){
        int i=pq.top()[1],j=pq.top()[2];
        pq.pop();
        if (vis[i][j]) continue;
        vis[i][j]=1;
        for (auto u:adj[i]){
            if (u.F==j) continue;
            int d=max(dis[i][j],u.S);
            if (d<dis[u.F][j] || dis[u.F][j]<0){
                dis[u.F][j]=d;
                pq.push({-d,u.F,j});
            }
        }
        for (auto u:adj[j]){
            if (u.F==i) continue;
            int d=max(dis[i][j],u.S);
            if (d<dis[i][u.F] || dis[i][u.F]<0){
                dis[i][u.F]=d;
                pq.push({-d,i,u.F});
            }
        }
    }return;
}
void init(int N, int M,
          vector<int> U, vector<int> V, vector<int> W) {
    n=N,m=M;
    for (int i=0;i<m;i++){
        adj[U[i]].pb({V[i],W[i]});
        adj[V[i]].pb({U[i],W[i]});
    }
    return;
}

int getMinimumFuelCapacity(int X, int Y) {
    dijkstra(X,Y);
    /*for (int i=0;i<n;i++){
        for (int j=0;j<n;j++){
            cout<<dis[i][j]<<' ';
        }cout<<endl;
    }*/
    return dis[Y][X];
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 5208 KB Output is correct
2 Correct 1 ms 5208 KB Output is correct
3 Correct 2 ms 5212 KB Output is correct
4 Correct 108 ms 6784 KB Output is correct
5 Correct 389 ms 12384 KB Output is correct
6 Correct 425 ms 10840 KB Output is correct
7 Correct 641 ms 17632 KB Output is correct
8 Correct 520 ms 9184 KB Output is correct
9 Runtime error 31 ms 17344 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 5208 KB Output is correct
2 Correct 1 ms 5208 KB Output is correct
3 Runtime error 62 ms 24684 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 5208 KB Output is correct
2 Correct 1 ms 5208 KB Output is correct
3 Correct 2 ms 5212 KB Output is correct
4 Correct 108 ms 6784 KB Output is correct
5 Correct 389 ms 12384 KB Output is correct
6 Correct 425 ms 10840 KB Output is correct
7 Correct 641 ms 17632 KB Output is correct
8 Correct 520 ms 9184 KB Output is correct
9 Correct 1 ms 5212 KB Output is correct
10 Correct 1102 ms 27012 KB Output is correct
11 Correct 1111 ms 15856 KB Output is correct
12 Correct 1266 ms 20016 KB Output is correct
13 Correct 850 ms 18860 KB Output is correct
14 Correct 934 ms 12544 KB Output is correct
15 Correct 1147 ms 9796 KB Output is correct
16 Correct 1107 ms 12280 KB Output is correct
17 Correct 1132 ms 13020 KB Output is correct
18 Correct 1419 ms 27232 KB Output is correct
19 Correct 857 ms 21664 KB Output is correct
20 Correct 1225 ms 18456 KB Output is correct
21 Execution timed out 2048 ms 38212 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 5212 KB Output is correct
2 Correct 1 ms 5208 KB Output is correct
3 Correct 1 ms 5208 KB Output is correct
4 Correct 2 ms 5212 KB Output is correct
5 Correct 108 ms 6784 KB Output is correct
6 Correct 389 ms 12384 KB Output is correct
7 Correct 425 ms 10840 KB Output is correct
8 Correct 641 ms 17632 KB Output is correct
9 Correct 520 ms 9184 KB Output is correct
10 Runtime error 31 ms 17344 KB Execution killed with signal 11
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 5208 KB Output is correct
2 Correct 1 ms 5208 KB Output is correct
3 Correct 2 ms 5212 KB Output is correct
4 Correct 108 ms 6784 KB Output is correct
5 Correct 389 ms 12384 KB Output is correct
6 Correct 425 ms 10840 KB Output is correct
7 Correct 641 ms 17632 KB Output is correct
8 Correct 520 ms 9184 KB Output is correct
9 Runtime error 31 ms 17344 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 5212 KB Output is correct
2 Correct 1 ms 5208 KB Output is correct
3 Correct 1 ms 5208 KB Output is correct
4 Correct 2 ms 5212 KB Output is correct
5 Correct 108 ms 6784 KB Output is correct
6 Correct 389 ms 12384 KB Output is correct
7 Correct 425 ms 10840 KB Output is correct
8 Correct 641 ms 17632 KB Output is correct
9 Correct 520 ms 9184 KB Output is correct
10 Runtime error 31 ms 17344 KB Execution killed with signal 11
11 Halted 0 ms 0 KB -