Submission #981939

# Submission time Handle Problem Language Result Execution time Memory
981939 2024-05-13T16:55:17 Z Abito Swapping Cities (APIO20_swap) C++17
0 / 100
2000 ms 97900 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[10][NN][NN],q;
vector<pair<int,int>> adj[NN];
bool vis[10][NN][NN];
void dijkstra(int X,int Y){
    dis[q][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[q][i][j]) continue;
        vis[q][i][j]=1;
        for (auto u:adj[i]){
            if (u.F==j) continue;
            int d=max(dis[q][i][j],u.S);
            if (d<dis[q][u.F][j] || dis[q][u.F][j]<0){
                dis[q][u.F][j]=d;
                pq.push({-d,u.F,j});
            }
        }
        for (auto u:adj[j]){
            if (u.F==i) continue;
            int d=max(dis[q][i][j],u.S);
            if (d<dis[q][i][u.F] || dis[q][i][u.F]<0){
                dis[q][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]});
    }
    memset(dis,-1,sizeof(dis));
    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[q++][Y][X];
}
# Verdict Execution time Memory Grader output
1 Correct 13 ms 41308 KB Output is correct
2 Correct 5 ms 41440 KB Output is correct
3 Correct 5 ms 41308 KB Output is correct
4 Correct 95 ms 44944 KB Output is correct
5 Correct 398 ms 50820 KB Output is correct
6 Correct 433 ms 51012 KB Output is correct
7 Correct 573 ms 54248 KB Output is correct
8 Correct 543 ms 50256 KB Output is correct
9 Runtime error 64 ms 90424 KB Execution killed with signal 7
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 41308 KB Output is correct
2 Correct 5 ms 41440 KB Output is correct
3 Runtime error 93 ms 97900 KB Execution killed with signal 7
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 41308 KB Output is correct
2 Correct 5 ms 41440 KB Output is correct
3 Correct 5 ms 41308 KB Output is correct
4 Correct 95 ms 44944 KB Output is correct
5 Correct 398 ms 50820 KB Output is correct
6 Correct 433 ms 51012 KB Output is correct
7 Correct 573 ms 54248 KB Output is correct
8 Correct 543 ms 50256 KB Output is correct
9 Correct 5 ms 41304 KB Output is correct
10 Correct 1098 ms 65584 KB Output is correct
11 Correct 1127 ms 54572 KB Output is correct
12 Correct 1171 ms 60824 KB Output is correct
13 Correct 849 ms 57924 KB Output is correct
14 Correct 926 ms 52656 KB Output is correct
15 Correct 1160 ms 50016 KB Output is correct
16 Correct 1109 ms 52500 KB Output is correct
17 Correct 1078 ms 52400 KB Output is correct
18 Correct 1366 ms 65268 KB Output is correct
19 Correct 863 ms 60428 KB Output is correct
20 Correct 1172 ms 60356 KB Output is correct
21 Execution timed out 2063 ms 77052 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 41304 KB Output is correct
2 Correct 13 ms 41308 KB Output is correct
3 Correct 5 ms 41440 KB Output is correct
4 Correct 5 ms 41308 KB Output is correct
5 Correct 95 ms 44944 KB Output is correct
6 Correct 398 ms 50820 KB Output is correct
7 Correct 433 ms 51012 KB Output is correct
8 Correct 573 ms 54248 KB Output is correct
9 Correct 543 ms 50256 KB Output is correct
10 Runtime error 64 ms 90424 KB Execution killed with signal 7
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 41308 KB Output is correct
2 Correct 5 ms 41440 KB Output is correct
3 Correct 5 ms 41308 KB Output is correct
4 Correct 95 ms 44944 KB Output is correct
5 Correct 398 ms 50820 KB Output is correct
6 Correct 433 ms 51012 KB Output is correct
7 Correct 573 ms 54248 KB Output is correct
8 Correct 543 ms 50256 KB Output is correct
9 Runtime error 64 ms 90424 KB Execution killed with signal 7
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 41304 KB Output is correct
2 Correct 13 ms 41308 KB Output is correct
3 Correct 5 ms 41440 KB Output is correct
4 Correct 5 ms 41308 KB Output is correct
5 Correct 95 ms 44944 KB Output is correct
6 Correct 398 ms 50820 KB Output is correct
7 Correct 433 ms 51012 KB Output is correct
8 Correct 573 ms 54248 KB Output is correct
9 Correct 543 ms 50256 KB Output is correct
10 Runtime error 64 ms 90424 KB Execution killed with signal 7
11 Halted 0 ms 0 KB -