Submission #1041766

# Submission time Handle Problem Language Result Execution time Memory
1041766 2024-08-02T07:53:16 Z Muhammet Swapping Cities (APIO20_swap) C++17
0 / 100
163 ms 10408 KB
#include <bits/stdc++.h>
#include "swap.h"
using namespace std;

const int N = 100005;

int n, m, v[N];

multiset <int> s;

void init(int n1, int m1, vector<int> u1, vector<int> v1, vector<int> w1) {
    m = m1;
    for(int i = 0; i < m1; i++){
        v[v1[i]] = (w1[i]);
        s.insert(w1[i]);
    }
}

int getMinimumFuelCapacity(int x, int y) {
    if(m <= 2 or min(x,y) == 0){
        return -1;
    }
    int ans = (v[x]+v[y]);
    s.erase(s.find(v[x]));
    s.erase(s.find(v[y]));
    ans += 2*(*s.begin());
    s.insert(v[x]);
    s.insert(v[y]);
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Runtime error 0 ms 604 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 163 ms 10408 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Runtime error 0 ms 604 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Runtime error 0 ms 604 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Runtime error 0 ms 604 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Runtime error 0 ms 604 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -