Submission #330234

# Submission time Handle Problem Language Result Execution time Memory
330234 2020-11-24T08:24:13 Z egas Swapping Cities (APIO20_swap) C++14
0 / 100
2000 ms 42180 KB
#include <bits/stdc++.h>
using namespace std;



map<int,set<int>> adj;
map<pair<int,int>,int> edwt;
multiset<int> wts;

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];
		wts.insert(W[i]);
		adj[x].insert(y);
		adj[y].insert(x);
		edwt[{x,y}]=z;
		edwt[{y,x}]=z;
	}
}

bool isCycle(){
	for(auto x:adj){
		if(x.second.size()<=1)return false;
	}
}
// void dfs(int src,int dest,mii &visit,int &res1,bool &found){
	// visit[src]=1;
	// if(src==dest){
		// found=1;
		// return ;
	// }
	// if(found)return ;
	// for(int x:adj[src]){
		// if(!visit[x]){
			// res1=max(res1,edwt[{src,x}]);
			// wts.erase(wts.find(edwt[{src,x}]));
			// dfs(x,dest,visit,res1,found);
			// if(found)return ;
		// }
	// }
// }

int getMinimumFuelCapacity(int X, int Y) {
	if(isCycle()){
		auto it = wts.end();
		it--;
		return *it;
	}else
		return -1;
}

Compilation message

swap.cpp: In function 'bool isCycle()':
swap.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type]
   27 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 2 ms 620 KB Output is correct
6 Correct 2 ms 620 KB Output is correct
7 Correct 2 ms 748 KB Output is correct
8 Correct 2 ms 748 KB Output is correct
9 Correct 387 ms 30444 KB Output is correct
10 Correct 533 ms 37100 KB Output is correct
11 Correct 501 ms 36548 KB Output is correct
12 Correct 664 ms 38636 KB Output is correct
13 Correct 578 ms 38892 KB Output is correct
14 Execution timed out 2075 ms 30572 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Execution timed out 2068 ms 42180 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 2 ms 620 KB Output is correct
6 Correct 2 ms 620 KB Output is correct
7 Correct 2 ms 748 KB Output is correct
8 Correct 2 ms 748 KB Output is correct
9 Correct 387 ms 30444 KB Output is correct
10 Correct 533 ms 37100 KB Output is correct
11 Correct 501 ms 36548 KB Output is correct
12 Correct 664 ms 38636 KB Output is correct
13 Correct 578 ms 38892 KB Output is correct
14 Execution timed out 2075 ms 30572 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct