Submission #996356

# Submission time Handle Problem Language Result Execution time Memory
996356 2024-06-10T13:44: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) {
	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 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 -