Submission #982758

# Submission time Handle Problem Language Result Execution time Memory
982758 2024-05-14T17:27:00 Z IUA_Hasin Swapping Cities (APIO20_swap) C++17
0 / 100
0 ms 348 KB
#include "swap.h"
#include <bits/stdc++.h>

#define ll                    long long

using namespace std;

ll N2;
set<pair<ll, ll>> s;
map<ll, ll> m;
ll a1, a2, b1, b2, c1, c2;

void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
      for(int i=0; i<N-1; i++){
        s.insert({W[i], V[i]});
        m[V[i]] = W[i];
      }

      for(auto u : s){
        cout << u.first << " " << u.second << endl;
      }
      N2 = N;
      if(N>2){
        auto it = s.lower_bound({0, 0});
        a1 = (*it).first;
        a2 = (*it).second;
        s.erase(it);
        it = s.lower_bound({0, 0});
        b1 = (*it).first;
        b2 = (*it).second;
        s.erase(it);
        it = s.lower_bound({0, 0});
        c1 = (*it).first;
        c2 = (*it).second;
      }
      //cout << a1 << " " << a2 << " " << b1 << " " << b2 << " " << c1 << " " << c2 << endl;
}

int getMinimumFuelCapacity(int X, int Y) {
  if(N2<=3){
    return -1;
  } else {
    if(X==0){
      if(Y==a2){
        return b1;
      } else {
        return m[Y];
      }
    } else if(Y==0){
      if(X==a2){
        return b1;
      } else {
        return m[X];
      }
    } else {
      if(X==a2){
        if(Y==b2){
          return c1;
        } else {
          return max(m[X], m[Y]);
        }
      } else if(Y==a2){
        if(X==b2){
          return c1;
        } else {
          return max(m[X], m[Y]);
        }
      } else {
        return max(m[X], m[Y]);
      }
    }
  }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -