답안 #1084632

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1084632 2024-09-06T15:08:30 Z blackslex 자매 도시 (APIO20_swap) C++17
7 / 100
83 ms 11100 KB
#include "swap.h"
#include <vector>
#include<bits/stdc++.h>

using namespace std;
using pii = pair<int, int>;

int n, m;
vector<int> w;
vector<pii> c;

void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
  n = N; m = M;
  w.resize(n + 5);
  for (int i = 0; i < m; i++) c.emplace_back(W[i], V[i]), w[V[i]] = W[i];
  sort(c.begin(), c.end());
}

int getMinimumFuelCapacity(int X, int Y) {
  if (X > Y) swap(X, Y);
  int ans = -1;
  vector<int> aux;
  for (auto &[x, y]: c) {
    if (y == X || y == Y) continue;
    aux.emplace_back(x);
    if (aux.size() == 2) break;
  }
  if (!X && aux.size() >= 2) ans = max(aux[1], w[Y]);
  if (X && aux.size() >= 1) ans = max({aux[0], w[X], w[Y]});
  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 60 ms 6692 KB Output is correct
4 Correct 65 ms 10548 KB Output is correct
5 Correct 83 ms 11100 KB Output is correct
6 Correct 72 ms 10668 KB Output is correct
7 Correct 66 ms 10828 KB Output is correct
8 Correct 63 ms 10632 KB Output is correct
9 Correct 65 ms 10788 KB Output is correct
10 Correct 66 ms 10628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -