답안 #375317

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
375317 2021-03-09T07:33:05 Z astoria 자매 도시 (APIO20_swap) C++14
7 / 100
132 ms 10748 KB
#include "bits/stdc++.h"
using namespace std;

const int NN=100005;
int len[NN];
vector<int> vals;

void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
	for(int i=0; i<M; i++){
		int v = V[i];
		len[v] = W[i];
		vals.push_back(len[v]);
	}
	sort(vals.begin(),vals.end());
}

int getMinimumFuelCapacity(int X, int Y) {
	
	if(vals.size()==2) return -1;
	
	if(X==0||Y==0){
		if(vals.size()<=3) return -1;
		if(len[Y]==vals[0]||len[Y]==vals[1]) return vals[2];
		else return len[Y];
	}
	
	int mx = max(len[X],len[Y]);
	
	if(vals[0]==len[X]&&vals[1]==len[Y]){
		mx = vals[2];
	}
	if(vals[0]==len[Y]&&vals[1]==len[X]){
		mx = vals[2];
	}
	
	return mx;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 112 ms 6536 KB Output is correct
4 Correct 115 ms 10316 KB Output is correct
5 Correct 125 ms 10748 KB Output is correct
6 Correct 111 ms 10208 KB Output is correct
7 Correct 115 ms 10596 KB Output is correct
8 Correct 115 ms 10388 KB Output is correct
9 Correct 132 ms 10340 KB Output is correct
10 Correct 113 ms 10404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 492 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -