Submission #394740

# Submission time Handle Problem Language Result Execution time Memory
394740 2021-04-27T09:06:37 Z suren Swapping Cities (APIO20_swap) C++14
0 / 100
2000 ms 39652 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
int n, m;
vector < int > u, v, w;
vector < int > vc[200045];
void init(int N, int M,
          std::vector<int> U, std::vector<int> V, std::vector<int> W) {
		n = N;
		m = M;
		u = U;
		v = V;
		w = W;
}
bool vis[200045];
int getMinimumFuelCapacity(int X, int Y) {
	int flag = true, i;
	map < pair < int , int >, int > mp;
	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;
		}
	}
	if( flag == true ){
		int ans = 0;
		for( i = 0; i < m; i ++ ){
			ans = max( ans, w[i] );
		}
		return ans;
	}
	
	return -1;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 4 ms 5068 KB Output is correct
5 Correct 5 ms 5196 KB Output is correct
6 Correct 5 ms 5196 KB Output is correct
7 Correct 6 ms 5196 KB Output is correct
8 Correct 6 ms 5196 KB Output is correct
9 Correct 301 ms 19132 KB Output is correct
10 Correct 820 ms 25484 KB Output is correct
11 Correct 1035 ms 28328 KB Output is correct
12 Correct 1095 ms 29800 KB Output is correct
13 Correct 1103 ms 29996 KB Output is correct
14 Execution timed out 2097 ms 30760 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Execution timed out 2092 ms 39652 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 4 ms 5068 KB Output is correct
5 Correct 5 ms 5196 KB Output is correct
6 Correct 5 ms 5196 KB Output is correct
7 Correct 6 ms 5196 KB Output is correct
8 Correct 6 ms 5196 KB Output is correct
9 Incorrect 3 ms 4940 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4940 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4940 KB Output is correct
2 Correct 3 ms 4940 KB Output is correct
3 Correct 3 ms 4940 KB Output is correct
4 Correct 4 ms 5068 KB Output is correct
5 Correct 5 ms 5196 KB Output is correct
6 Correct 5 ms 5196 KB Output is correct
7 Correct 6 ms 5196 KB Output is correct
8 Correct 6 ms 5196 KB Output is correct
9 Correct 301 ms 19132 KB Output is correct
10 Correct 820 ms 25484 KB Output is correct
11 Correct 1035 ms 28328 KB Output is correct
12 Correct 1095 ms 29800 KB Output is correct
13 Correct 1103 ms 29996 KB Output is correct
14 Execution timed out 2097 ms 30760 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4940 KB Output isn't correct