답안 #394745

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
394745 2021-04-27T09:11:28 Z suren 자매 도시 (APIO20_swap) C++14
컴파일 오류
0 ms 0 KB
#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

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;
      |      ^