답안 #405947

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
405947 2021-05-17T05:30:52 Z Maqsut_03 자매 도시 (APIO20_swap) C++17
0 / 100
145 ms 15364 KB
#include "swap.h"
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>

#define ll int
#define pl pair<ll, ll> 
#define llv vector<ll>
#define pb push_back
#define ppb(x, y) push_back({x, y})
#define pv vector<pl>
#define sz size()
#define ss second
#define ff first

using namespace std;
const int N = 2 * 1e5 + 3;

ll q = 0, p = 0, n, m, a, b, c;
llv v(N);
pv v0[N];
pl w[N];
bool f = 1;

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++) 
	{
    	v0[V[i]].ppb(U[i], W[i]);
    	v0[U[i]].ppb(V[i], W[i]);
	}
	  
	for (int i=0; i<n; i++)
	{
		if (v0[i].sz == 1) q++;
		if (v0[i].sz == 2) p++;
	}  
	if (q == 2 && q + p == n) f = 0;
	for (int i=0; i<m; i++)
	    	w[i] = {W[i], V[i]};
    
	for (int i=0; i<m; i++) v[w[i].ss] = w[i].ff;
	sort(w, w+m);
	a = w[0].ss;
	b = w[1].ss;
	c = w[2].ss;
	return ;
}

int getMinimumFuelCapacity(int X, int Y) 
{
	if (f == 0) return -1;
	ll ans;
	if ((X == a && Y == b) || (X == b && Y == a)) ans = c ;
	else if (X == a || Y == a) ans = b;
	else ans = a;
	ans = max({ans, v[Y], v[X]}); 
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 5708 KB Output is correct
2 Correct 5 ms 5708 KB Output is correct
3 Correct 4 ms 5708 KB Output is correct
4 Correct 5 ms 5708 KB Output is correct
5 Correct 4 ms 5836 KB Output is correct
6 Correct 5 ms 5836 KB Output is correct
7 Correct 4 ms 5808 KB Output is correct
8 Correct 4 ms 5836 KB Output is correct
9 Correct 52 ms 10684 KB Output is correct
10 Correct 64 ms 11716 KB Output is correct
11 Correct 70 ms 11628 KB Output is correct
12 Correct 74 ms 11956 KB Output is correct
13 Correct 72 ms 11952 KB Output is correct
14 Correct 60 ms 10772 KB Output is correct
15 Correct 129 ms 13592 KB Output is correct
16 Correct 126 ms 13480 KB Output is correct
17 Correct 129 ms 13724 KB Output is correct
18 Correct 131 ms 13724 KB Output is correct
19 Incorrect 67 ms 10048 KB Output isn't correct
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 5708 KB Output is correct
2 Correct 5 ms 5708 KB Output is correct
3 Incorrect 145 ms 15364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 5708 KB Output is correct
2 Correct 5 ms 5708 KB Output is correct
3 Correct 4 ms 5708 KB Output is correct
4 Correct 5 ms 5708 KB Output is correct
5 Correct 4 ms 5836 KB Output is correct
6 Correct 5 ms 5836 KB Output is correct
7 Correct 4 ms 5808 KB Output is correct
8 Correct 4 ms 5836 KB Output is correct
9 Incorrect 4 ms 5708 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 5708 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 5708 KB Output is correct
2 Correct 5 ms 5708 KB Output is correct
3 Correct 4 ms 5708 KB Output is correct
4 Correct 5 ms 5708 KB Output is correct
5 Correct 4 ms 5836 KB Output is correct
6 Correct 5 ms 5836 KB Output is correct
7 Correct 4 ms 5808 KB Output is correct
8 Correct 4 ms 5836 KB Output is correct
9 Correct 52 ms 10684 KB Output is correct
10 Correct 64 ms 11716 KB Output is correct
11 Correct 70 ms 11628 KB Output is correct
12 Correct 74 ms 11956 KB Output is correct
13 Correct 72 ms 11952 KB Output is correct
14 Correct 60 ms 10772 KB Output is correct
15 Correct 129 ms 13592 KB Output is correct
16 Correct 126 ms 13480 KB Output is correct
17 Correct 129 ms 13724 KB Output is correct
18 Correct 131 ms 13724 KB Output is correct
19 Incorrect 145 ms 15364 KB Output isn't correct
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 5708 KB Output isn't correct