답안 #678595

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
678595 2023-01-06T08:13:53 Z Dan4Life 자매 도시 (APIO20_swap) C++17
0 / 100
295 ms 16380 KB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define SZ(a) (int)a.size()
using ll = long long;

const int maxn = (int)1e5+10;
const int INF = (ll)1e9;

vector<pair<int,int>> adj[maxn];
ll dis[maxn]; int tot = 0;
int par[maxn];
bool vis[maxn];
int n, m;
bool noCycle = false;
multiset<int> S;
int wei[maxn];

void init(int N, int M, vector<int> u, vector<int> v, vector<int> w) {
	n = N, m = M;
	for(int i = 0; i < M; i++){
		wei[v[i]]=w[i];
		adj[u[i]].pb({v[i],w[i]});
		adj[v[i]].pb({u[i],w[i]}); tot=max(tot,w[i]);
		S.insert(w[i]);
	}
	if(M==N) noCycle=false;
	else noCycle=true;
}
/*
5 4
1 2 3
2 3 4
3 4 5
4 5 6
4
1 2
1 5
2 5
2 4
*/

int getMinimumFuelCapacity(int x, int y) {
	int ans = 0;
	if(n<=3) return -1;
	if(x==0){
		S.erase(S.find(wei[y])); ans = wei[y];
		ans = max({ans, *S.begin(), *next(S.begin())});
		S.insert(wei[y]);
	}
	else{
		S.erase(S.find(wei[x]));
		S.erase(S.find(wei[y]));
		ans = max(wei[x],wei[y]);
		ans = max(ans, *S.begin());
		S.insert(wei[x]); S.insert(wei[y]);
		return ans;
	}
	return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Runtime error 4 ms 5204 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Incorrect 295 ms 16380 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Runtime error 4 ms 5204 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Runtime error 4 ms 5204 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Runtime error 4 ms 5204 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Runtime error 4 ms 5204 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -