답안 #597267

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
597267 2022-07-15T20:14:41 Z Ozy 자매 도시 (APIO20_swap) C++17
0 / 100
96 ms 11960 KB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debug(a) cout << #a << " = " << a << endl
#define debugsl(a) cout << #a << " = " << a << ", "

#define MAX 100000
#define u second.first
#define v second.second
#define w first

lli peso[MAX+2],a,b,c,n,m;
vector<pair<lli,lli> > orden;

void init(int N, int M,std::vector<int> U, std::vector<int> V, std::vector<int> W) {
    n = N;
    m = M;

    rep(i,0,m-1) {
        peso[V[i]+1] = W[i];
        orden.push_back({W[i],V[i]+1});
    }
    sort(orden.begin(), orden.end());
}

int getMinimumFuelCapacity(int X, int Y) {
    X++;
    Y++;

    if (n < 4) return -1;

    c = peso[Y];
    if (X == 0) {
        if (orden[0].second == Y) X = orden[1].second;
        else X = orden[0].second;
    }
    b = peso[X];

    for (auto act : orden) {
        if (act.second == Y || act.second == X) continue;
        a = act.first;
        break;
    }

    a = max(a,b);
    a = max(a,c);
    return a;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 91 ms 7724 KB Output is correct
4 Correct 89 ms 11692 KB Output is correct
5 Incorrect 96 ms 11960 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -