Submission #996355

# Submission time Handle Problem Language Result Execution time Memory
996355 2024-06-10T13:42:00 Z Dan4Life Swapping Cities (APIO20_swap) C++17
0 / 100
0 ms 348 KB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;
#define all(a) begin(a),end(a)

const int mxN = (int)3e5+10;
multiset<int> S;
int edge[mxN];

void init(int N, int M, vector<int> U, vector<int> V, vector<int> W) {
	for(auto u : W) S.insert(u);
	for(int i = 0; i < M; i++){
		edge[V[i]] = W[i];
	}
}

int getMinimumFuelCapacity(int X, int Y) {
	if(X>Y) swap(X,Y);
	int ans = 0;
	if(X==0){
		ans = max(ans, edge[Y]);
		S.erase(S.find(edge[Y]));
	}
	else{
		ans = max(ans, edge[X]);
		ans = max(ans, edge[Y]);
		S.erase(S.find(edge[X]));
		S.erase(S.find(edge[Y]));
	}
	ans = max(ans, *begin(S));
	S.insert(edge[Y]);
	if(!X) S.insert(edge[X]);
	return ans;
}
# 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 -