답안 #678596

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
678596 2023-01-06T08:14:44 Z Dan4Life 자매 도시 (APIO20_swap) C++17
7 / 100
386 ms 20772 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) {
	if(n<=3) return -1;
	int ans = 0;
	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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 1 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 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 290 ms 16348 KB Output is correct
4 Correct 351 ms 20684 KB Output is correct
5 Correct 325 ms 20760 KB Output is correct
6 Correct 333 ms 20552 KB Output is correct
7 Correct 381 ms 20772 KB Output is correct
8 Correct 375 ms 20224 KB Output is correct
9 Correct 367 ms 20456 KB Output is correct
10 Correct 386 ms 20136 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 1 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 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 1 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 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 1 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 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Runtime error 4 ms 5204 KB Execution killed with signal 6
5 Halted 0 ms 0 KB -