제출 #334823

#제출 시각아이디문제언어결과실행 시간메모리
334823limabeans자매 도시 (APIO20_swap)C++17
0 / 100
738 ms524292 KiB
#include <bits/stdc++.h>
#include "swap.h"

using namespace std;

using ll = long long;
const int maxn = 1e5 + 10;

int n;
vector<pair<ll,int>> g[maxn];


bool loop = false;
ll maxW = 0;

void dfs(int at, int p, int dep) {
    if (dep==n) loop=true;
    for (auto ed: g[at]) {
	int to = ed.second;
	if (to == p) continue;
	dfs(to,at,dep+1);
    }
}


void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
    n=N;
    for (int i=0; i<M; i++) {
	g[U[i]].push_back({W[i],V[i]});
	g[V[i]].push_back({W[i],U[i]});
	maxW=max(maxW,1ll*W[i]);
    }

    dfs(0,-1,0);
}

int getMinimumFuelCapacity(int X, int Y) {
    if (loop) return maxW;
    return -1;
}

/*
  int main() {
  init(5, 6, {0, 0, 1, 1, 1, 2}, {1, 2, 2, 3, 4, 3}, {4, 4, 1, 2, 10, 3});
  cout<<getMinimumFuelCapacity(1, 2)<<endl;
  cout<<getMinimumFuelCapacity(2, 4)<<endl;
  cout<<getMinimumFuelCapacity(0, 1)<<endl;
  return 0;
  }
*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...