제출 #996356

#제출 시각아이디문제언어결과실행 시간메모리
996356Dan4Life자매 도시 (APIO20_swap)C++17
0 / 100
0 ms348 KiB
#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) {
	int ans = 0;
	if(X==0){
		ans = max(ans, edge[Y]);
		S.erase(S.find(edge[Y]));
		
		ans = max(ans, *begin(S));
		S.insert(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[X]);
		S.insert(edge[Y]);
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...