Submission #394745

#TimeUsernameProblemLanguageResultExecution timeMemory
394745surenSwapping Cities (APIO20_swap)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mk make_pair int n, m, flag = true; int ans = 0; vector < int > u, v, w; vector < int > vc[200045]; map < pair < int , int >, int > mp; void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) { int i; n = N; m = M; u = U; v = V; w = W; for( i = 0; i < m; i ++ ){ vc[ u[i] ].pb( v[i] ); vc[ v[i] ].pb( u[i] ); mp[ mk( u[i], v[i] ) ] = w[i]; mp[ mk( v[i], u[i] ) ] = w[i]; } for( i = 0; i < n; i ++ ){ if( vc[i].size() != 2 ){ flag = false; break; } } for( i = 0; i < m; i ++ ){ ans = max( ans, w[i] ); } return ans; } bool vis[200045]; int getMinimumFuelCapacity(int X, int Y) { int i; if( flag == true ){ return ans; } return -1; }

Compilation message (stderr)

swap.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
swap.cpp:35:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
   35 |   return ans;
      |          ^~~
swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:39:6: warning: unused variable 'i' [-Wunused-variable]
   39 |  int i;
      |      ^