Submission #981073

# Submission time Handle Problem Language Result Execution time Memory
981073 2024-05-12T18:55:12 Z Abito Swapping Cities (APIO20_swap) C++17
0 / 100
2000 ms 35148 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){
    for (int i=0;i<n;i++) for (int j=0;j<n;j++) dis[i][j]=INT_MAX,vis[i][j]=0;
    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]=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]=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;
    }*/
    if (dis[Y][X]==INT_MAX) return -1;
    return dis[Y][X];
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 90 ms 6032 KB Output is correct
5 Correct 395 ms 11796 KB Output is correct
6 Correct 432 ms 10536 KB Output is correct
7 Correct 625 ms 16852 KB Output is correct
8 Correct 530 ms 9172 KB Output is correct
9 Runtime error 99 ms 17336 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Runtime error 140 ms 24684 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 90 ms 6032 KB Output is correct
5 Correct 395 ms 11796 KB Output is correct
6 Correct 432 ms 10536 KB Output is correct
7 Correct 625 ms 16852 KB Output is correct
8 Correct 530 ms 9172 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1143 ms 26436 KB Output is correct
11 Correct 1143 ms 16084 KB Output is correct
12 Correct 1163 ms 19280 KB Output is correct
13 Correct 876 ms 17456 KB Output is correct
14 Correct 995 ms 12532 KB Output is correct
15 Correct 1178 ms 9916 KB Output is correct
16 Correct 1093 ms 12244 KB Output is correct
17 Correct 1091 ms 14012 KB Output is correct
18 Correct 1477 ms 27700 KB Output is correct
19 Correct 860 ms 21032 KB Output is correct
20 Correct 1202 ms 18236 KB Output is correct
21 Execution timed out 2044 ms 35148 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 90 ms 6032 KB Output is correct
6 Correct 395 ms 11796 KB Output is correct
7 Correct 432 ms 10536 KB Output is correct
8 Correct 625 ms 16852 KB Output is correct
9 Correct 530 ms 9172 KB Output is correct
10 Runtime error 99 ms 17336 KB Execution killed with signal 11
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 90 ms 6032 KB Output is correct
5 Correct 395 ms 11796 KB Output is correct
6 Correct 432 ms 10536 KB Output is correct
7 Correct 625 ms 16852 KB Output is correct
8 Correct 530 ms 9172 KB Output is correct
9 Runtime error 99 ms 17336 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 90 ms 6032 KB Output is correct
6 Correct 395 ms 11796 KB Output is correct
7 Correct 432 ms 10536 KB Output is correct
8 Correct 625 ms 16852 KB Output is correct
9 Correct 530 ms 9172 KB Output is correct
10 Runtime error 99 ms 17336 KB Execution killed with signal 11
11 Halted 0 ms 0 KB -