Submission #979620

# Submission time Handle Problem Language Result Execution time Memory
979620 2024-05-11T08:59:32 Z vjudge1 Swapping Cities (APIO20_swap) C++17
0 / 100
68 ms 10876 KB
#include <time.h>
#include <cstdlib>
#include <stack>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <map>
#include <set>
#include <iterator>
#include <deque>
#include <queue>
#include <sstream>
#include <array>
#include <string>
#include <tuple>
#include <chrono>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <list>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <bitset>


#include "swap.h"

#include <cassert>
#include <cstdio>

#include <string>

#include <vector>
using namespace std;
vector<pair<int, int>> g[200005];
pair<int, int> p[200005];
map<pair<int, int>, int> mp, pos;
set<pair<int, int>> st;
int N, M;
void init(int N, int M,
          std::vector<int> U, std::vector<int> V, std::vector<int> W) {
}

int getMinimumFuelCapacity(int X, int Y) {
  X++;
    Y++;
    if(N <= 3)
        return -1;
    int mx = 0;
    if(X != 1) mx = mp[{1, X}];
    if(Y != 1) mx = max(mx, mp[{1, Y}]);


    if(X != 1) st.erase({mp[{1, X}], pos[{1, X}]});
    if(Y != 1) st.erase({mp[{1, Y}], pos[{1, Y}]});
    
    pair<int, int> p = *st.begin();
    st.erase(st.begin());
    if(X != 1 && Y != 1){
        st.insert(p);
        if(X != 1) st.insert({mp[{1, X}], pos[{1, X}]});
        if(Y != 1) st.insert({mp[{1, Y}], pos[{1, Y}]});
        return max(mx, p.first);
    }
    else{
        pair<int, int> p1 = *st.begin();
        st.insert(p1);
        st.insert(p);
        if(X != 1) st.insert({mp[{1, X}], pos[{1, X}]});
        if(Y != 1) st.insert({mp[{1, Y}], pos[{1, Y}]});
        return max({mx, p.first, p1.first});
    }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Correct 2 ms 6328 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 2 ms 6492 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 3 ms 6492 KB Output is correct
8 Correct 2 ms 6492 KB Output is correct
9 Correct 19 ms 8236 KB Output is correct
10 Correct 23 ms 8796 KB Output is correct
11 Correct 23 ms 8540 KB Output is correct
12 Correct 29 ms 8736 KB Output is correct
13 Correct 24 ms 8784 KB Output is correct
14 Correct 24 ms 8380 KB Output is correct
15 Correct 65 ms 10460 KB Output is correct
16 Correct 64 ms 10384 KB Output is correct
17 Correct 66 ms 10876 KB Output is correct
18 Correct 65 ms 10428 KB Output is correct
19 Incorrect 39 ms 8984 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Correct 2 ms 6328 KB Output is correct
3 Incorrect 68 ms 10312 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Correct 2 ms 6328 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 2 ms 6492 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 3 ms 6492 KB Output is correct
8 Correct 2 ms 6492 KB Output is correct
9 Incorrect 2 ms 6488 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Correct 2 ms 6328 KB Output is correct
3 Correct 2 ms 6492 KB Output is correct
4 Correct 2 ms 6492 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 3 ms 6492 KB Output is correct
8 Correct 2 ms 6492 KB Output is correct
9 Correct 19 ms 8236 KB Output is correct
10 Correct 23 ms 8796 KB Output is correct
11 Correct 23 ms 8540 KB Output is correct
12 Correct 29 ms 8736 KB Output is correct
13 Correct 24 ms 8784 KB Output is correct
14 Correct 24 ms 8380 KB Output is correct
15 Correct 65 ms 10460 KB Output is correct
16 Correct 64 ms 10384 KB Output is correct
17 Correct 66 ms 10876 KB Output is correct
18 Correct 65 ms 10428 KB Output is correct
19 Incorrect 68 ms 10312 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6488 KB Output isn't correct
2 Halted 0 ms 0 KB -