Submission #563151

# Submission time Handle Problem Language Result Execution time Memory
563151 2022-05-16T11:35:24 Z Aktan Swapping Cities (APIO20_swap) C++14
0 / 100
132 ms 19248 KB
#include "swap.h"
#include <bits/stdc++.h>
using namespace std;

#ifndef EVAL
#include "grader.cpp"
#endif

vector<int> e[100005];
int used[100005],mx=0;
bool h=0;
void dfs(int x,int p){
	if(h==1){
		return;
	}
	used[x]++;
	if(used[x]==2){
		h=1;
		return;
	}
	for(auto w : e[x]){
		if(used[w]<1 && w!=p){
			dfs(w,x);
		}
	}
}
void init(int N, int M, vector<int> U, vector<int> V, vector<int> W){
	for(int i=0;i<M;i++){
		e[U[i]].push_back(V[i]);
		e[V[i]].push_back(U[i]);
		mx=max(mx,W[i]);
	}
	dfs(0,-1);
}

int getMinimumFuelCapacity(int X, int Y) {
	if(h==0){
		return -1;
	}
	else{
		return mx;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2772 KB Output is correct
8 Correct 2 ms 2664 KB Output is correct
9 Correct 43 ms 11104 KB Output is correct
10 Correct 59 ms 13904 KB Output is correct
11 Correct 83 ms 13388 KB Output is correct
12 Correct 73 ms 14172 KB Output is correct
13 Correct 64 ms 15256 KB Output is correct
14 Correct 46 ms 10992 KB Output is correct
15 Correct 111 ms 17748 KB Output is correct
16 Correct 132 ms 16532 KB Output is correct
17 Correct 108 ms 19248 KB Output is correct
18 Correct 111 ms 18392 KB Output is correct
19 Incorrect 54 ms 8680 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Incorrect 91 ms 10172 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2772 KB Output is correct
8 Correct 2 ms 2664 KB Output is correct
9 Incorrect 2 ms 2660 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2660 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 1 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2772 KB Output is correct
8 Correct 2 ms 2664 KB Output is correct
9 Correct 43 ms 11104 KB Output is correct
10 Correct 59 ms 13904 KB Output is correct
11 Correct 83 ms 13388 KB Output is correct
12 Correct 73 ms 14172 KB Output is correct
13 Correct 64 ms 15256 KB Output is correct
14 Correct 46 ms 10992 KB Output is correct
15 Correct 111 ms 17748 KB Output is correct
16 Correct 132 ms 16532 KB Output is correct
17 Correct 108 ms 19248 KB Output is correct
18 Correct 111 ms 18392 KB Output is correct
19 Incorrect 91 ms 10172 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2660 KB Output isn't correct
2 Halted 0 ms 0 KB -