답안 #996358

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
996358 2024-06-10T13:47:29 Z Dan4Life 자매 도시 (APIO20_swap) C++17
7 / 100
208 ms 14676 KB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;
#define all(a) begin(a),end(a)
#define sz(a) (int)a.size()
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]));
		
		if(sz(S)<2) return -1;
		ans = max(ans, *next(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]));
		
		if(S.empty()) return -1;
		ans = max(ans, *begin(S));
		S.insert(edge[X]);
		S.insert(edge[Y]);
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 0 ms 348 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 192 ms 10388 KB Output is correct
4 Correct 184 ms 14520 KB Output is correct
5 Correct 201 ms 14676 KB Output is correct
6 Correct 208 ms 14396 KB Output is correct
7 Correct 199 ms 14552 KB Output is correct
8 Correct 202 ms 14340 KB Output is correct
9 Correct 195 ms 14288 KB Output is correct
10 Correct 190 ms 14092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 0 ms 348 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 0 ms 348 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 0 ms 348 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 0 ms 348 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -