답안 #979722

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
979722 2024-05-11T10:22:13 Z Marcus 자매 도시 (APIO20_swap) C++17
6 / 100
100 ms 16048 KB
#include <swap.h>
#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<vector<pair<int, int>>> adj;
vector<bool> visited;
 
bool cycle = false;
int gas = 0;
void dfs(int s, int v)
{
	if (visited[s]) return;
	visited[s] = true;
	for (auto u: adj[s])
	{
		if (visited[u.first] && u.first != v) cycle = true;
		gas = max(gas, u.second);
		dfs(u.first, s);
	}
}
 
void init(int n1, int m1, vector<int> v, vector<int> u, vector<int> w) {
	n = n1;
	m = m1;
	adj.resize(n+1);
	visited.resize(n+1);
	for (int i=0; i<m; i++)
	{
		adj[v[i]].push_back({u[i], w[i]});
		adj[u[i]].push_back({v[i], w[i]});
	}
}
 
int getMinimumFuelCapacity(int x, int y){
	dfs(1, 0);
	return (cycle ? gas : -1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 38 ms 8412 KB Output is correct
10 Correct 37 ms 10676 KB Output is correct
11 Correct 48 ms 9688 KB Output is correct
12 Correct 39 ms 10180 KB Output is correct
13 Correct 39 ms 11460 KB Output is correct
14 Correct 33 ms 8128 KB Output is correct
15 Correct 82 ms 13204 KB Output is correct
16 Correct 78 ms 12036 KB Output is correct
17 Correct 79 ms 13028 KB Output is correct
18 Correct 84 ms 13772 KB Output is correct
19 Correct 47 ms 5708 KB Output is correct
20 Correct 80 ms 15312 KB Output is correct
21 Correct 82 ms 15336 KB Output is correct
22 Correct 100 ms 15932 KB Output is correct
23 Correct 84 ms 16048 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 66 ms 10088 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Incorrect 0 ms 344 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 38 ms 8412 KB Output is correct
10 Correct 37 ms 10676 KB Output is correct
11 Correct 48 ms 9688 KB Output is correct
12 Correct 39 ms 10180 KB Output is correct
13 Correct 39 ms 11460 KB Output is correct
14 Correct 33 ms 8128 KB Output is correct
15 Correct 82 ms 13204 KB Output is correct
16 Correct 78 ms 12036 KB Output is correct
17 Correct 79 ms 13028 KB Output is correct
18 Correct 84 ms 13772 KB Output is correct
19 Incorrect 66 ms 10088 KB Output isn't correct
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -