Submission #1041763

#TimeUsernameProblemLanguageResultExecution timeMemory
1041763KasymKSwapping Cities (APIO20_swap)C++17
6 / 100
60 ms18880 KiB
#include "bits/stdc++.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} const int MOD = 1e9+7; const int INF = 1e9; const int N = 2e5+5; vector<pii> adj[N]; int mn = INF, mx = 0; int deg[N]; 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]}); umax(mx, w[i]); deg[u[i]]++, deg[v[i]]++; } for(int i = 0; i < n; ++i) umin(mn, deg[i]); } int getMinimumFuelCapacity(int x, int y){ if(mn == 1) return -1; else return mx; // you need to traverse all edges on cycle }
#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...