Submission #678190

#TimeUsernameProblemLanguageResultExecution timeMemory
678190Dan4Life자매 도시 (APIO20_swap)C++17
6 / 100
136 ms15704 KiB
#include "swap.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define fi first #define se second #define SZ(a) (int)a.size() using ll = long long; const int maxn = (int)1e5+10; const ll LINF = (ll)1e18; vector<pair<int,int>> adj[maxn]; ll dis[maxn]; int tot = 0; int par[maxn]; bool vis[maxn]; bool noCycle = false; void dfs(int s, int p, int d=0){ dis[s]=d; par[s]=p;vis[s]=1; for(auto u : adj[s]){ if(!vis[u.fi]) dfs(u.fi,s, d+u.se); } } void init(int N, int M, vector<int> u, vector<int> v, vector<int> w) { for(int i = 0; i < M; i++){ adj[u[i]].pb({v[i],w[i]}); adj[v[i]].pb({u[i],w[i]}); tot=max(tot,w[i]); } if(M==N) noCycle=false; else noCycle=true; } /* 5 4 1 2 3 2 3 4 3 4 5 4 5 6 4 1 2 1 5 2 5 2 4 */ int getMinimumFuelCapacity(int x, int y) { if(noCycle) return -1; return tot; }

Compilation message (stderr)

swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:48:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   48 |  if(noCycle) return -1; return tot;
      |  ^~
swap.cpp:48:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   48 |  if(noCycle) return -1; return tot;
      |                         ^~~~~~
#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...