Submission #1069447

# Submission time Handle Problem Language Result Execution time Memory
1069447 2024-08-22T00:04:56 Z pawned Swapping Cities (APIO20_swap) C++17
0 / 100
1 ms 2904 KB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;

#include "swap.h"

const int MAX = 1e5 + 5;

int N, M;

vector<ii> adj[MAX];	// {vertex, dist}

vi wt;

int cost[MAX];

void init(int N_g, int M_g, vi U_g, vi V_g, vi W_g) {
	N = N_g;
	M = M_g;
	for (int i = 0; i < M; i++) {
		adj[U_g[i]].pb({V_g[i], W_g[i]});
		adj[V_g[i]].pb({U_g[i], W_g[i]});
		cost[max(U_g[i], V_g[i])] = W_g[i];
		wt.pb(W_g[i]);
	}
	sort(wt.begin(), wt.end());
}

int getMinimumFuelCapacity(int X, int Y) {
	if (N == 2)
		return -1;
	if (X == 0)
		return max(wt[1], cost[Y]);
	return max(cost[X], cost[Y]);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2904 KB Output is correct
2 Incorrect 1 ms 2904 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2904 KB Output is correct
2 Incorrect 1 ms 2904 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2904 KB Output is correct
2 Incorrect 1 ms 2904 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2904 KB Output is correct
2 Incorrect 1 ms 2904 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2904 KB Output is correct
2 Incorrect 1 ms 2904 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2904 KB Output is correct
2 Incorrect 1 ms 2904 KB Output isn't correct
3 Halted 0 ms 0 KB -