답안 #563148

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
563148 2022-05-16T11:31:44 Z Aktan 자매 도시 (APIO20_swap) C++14
0 / 100
88 ms 10200 KB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;

#ifndef EVAL
#include "grader.cpp"
#endif

vector<int> e[100005];
int used[100005],mx=0;
bool h=0;
void dfs(int x){
	used[x]++;
	if(e[x].size()<2){
		h=1;
		return;
	}
	if(h==1){
		return;
	}
	for(auto w : e[x]){
		if(used[w]==0){
			dfs(w);
		}
	}
}
void init(int N, int M, vector<int> U, vector<int> V, vector<int> W){
	for(int i=0;i<M;i++){
		e[U[i]].push_back(V[i]);
		e[V[i]].push_back(U[i]);
		mx=max(mx,W[i]);
	}
	for(int i=0;i<N;i++){
		if(used[i]==0){
			h=0;
			dfs(i);
		}
	}
}

int getMinimumFuelCapacity(int X, int Y) {
	if(h==1){
		return -1;
	}
	else{
		return mx;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 3 ms 2644 KB Output is correct
6 Incorrect 2 ms 2644 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Incorrect 88 ms 10200 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 3 ms 2644 KB Output is correct
6 Incorrect 2 ms 2644 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 3 ms 2644 KB Output is correct
6 Incorrect 2 ms 2644 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 3 ms 2644 KB Output is correct
6 Incorrect 2 ms 2644 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 3 ms 2644 KB Output is correct
6 Incorrect 2 ms 2644 KB Output isn't correct
7 Halted 0 ms 0 KB -