Submission #493425

# Submission time Handle Problem Language Result Execution time Memory
493425 2021-12-11T09:38:27 Z vendx_greyback Swapping Cities (APIO20_swap) C++14
6 / 100
98 ms 10648 KB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;

const int mxn = 1e5;
int par[mxn], mx = 0;
bool isLine = true;

int get(int u){
    
    if(u == par[u])
        return u;
        
    return par[u] = get(par[u]);
    
}

void join(int u, int v){
    
    u = get(u);
    v = get(v);
    
    par[u] = v;
    
}

void init(int n, int m, vector<int> u, vector<int> v, vector<int> w){
    
    for(int i = 0; i < n; i++)
        par[i] = i;
    
    for(int i = 0; i < m; i++){
        
        if(get(u[i]) == get(v[i]))
            isLine = false;
        
        else
            join(u[i], v[i]);
            
        mx = max(mx, w[i]);
        
    }
    
}

int getMinimumFuelCapacity(int x, int y){
    return (isLine? -1: mx);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 25 ms 4044 KB Output is correct
10 Correct 34 ms 4868 KB Output is correct
11 Correct 30 ms 4772 KB Output is correct
12 Correct 32 ms 5136 KB Output is correct
13 Correct 32 ms 5044 KB Output is correct
14 Correct 31 ms 4428 KB Output is correct
15 Correct 94 ms 9036 KB Output is correct
16 Correct 91 ms 8880 KB Output is correct
17 Correct 85 ms 9148 KB Output is correct
18 Correct 86 ms 9248 KB Output is correct
19 Correct 59 ms 6020 KB Output is correct
20 Correct 89 ms 10052 KB Output is correct
21 Correct 83 ms 10300 KB Output is correct
22 Correct 89 ms 10612 KB Output is correct
23 Correct 98 ms 10648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 84 ms 8296 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 25 ms 4044 KB Output is correct
10 Correct 34 ms 4868 KB Output is correct
11 Correct 30 ms 4772 KB Output is correct
12 Correct 32 ms 5136 KB Output is correct
13 Correct 32 ms 5044 KB Output is correct
14 Correct 31 ms 4428 KB Output is correct
15 Correct 94 ms 9036 KB Output is correct
16 Correct 91 ms 8880 KB Output is correct
17 Correct 85 ms 9148 KB Output is correct
18 Correct 86 ms 9248 KB Output is correct
19 Incorrect 84 ms 8296 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct