Submission #330647

# Submission time Handle Problem Language Result Execution time Memory
330647 2020-11-26T04:03:25 Z egas Swapping Cities (APIO20_swap) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
map<int,set<int>> adj;
multiset<int> ms;
map<pair<int,int>,int> edwt;
int SUBTASK1=0;
bool isCyc=0;
bool isSubtask1=true;
bool isCycle(){
	for(auto x:adj){
		if(x.second.size()<=1)return false;
		if(x.second.size()>2)isSubtask1=false;
	}
	return true;
}
void init(int N, int M,std::vector<int> U, std::vector<int> V, std::vector<int> W) {
	for(int i=0;i<M;i++){
		int x=U[i];
		int y=V[i];
		int z=W[i];
		ms.insert(z);
		edwt[{min(x,y),max(x,y)}]=z;
		SUBTASK1=max(SUBTASK1,(W[i]));
		adj[x].insert(y);
		adj[y].insert(x);
	}
	isCyc=isCycle();
}
 
int getMinimumFuelCapacity(int X, int Y) {
	if(isSubtask1){
		if(isCyc){
			return SUBTASK1;
		}else
			return -1;
	}else{
		if(1 or min(X,Y)==0){
			return -1;
		}
		return res;
	}
}

Compilation message

swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:40:10: error: 'res' was not declared in this scope
   40 |   return res;
      |          ^~~