Submission #375316

# Submission time Handle Problem Language Result Execution time Memory
375316 2021-03-09T07:30:16 Z astoria Swapping Cities (APIO20_swap) C++14
0 / 100
108 ms 6408 KB
#include "bits/stdc++.h"
#include "swap.h"
using namespace std;

const int NN=100005;
int len[NN];
vector<int> vals;

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 v = V[i];
		len[v] = W[i];
		vals.push_back(len[v]);
	}
	sort(vals.begin(),vals.end());
}

int getMinimumFuelCapacity(int X, int Y) {
	
	if(X==0||Y==0) return -1;
	
	int mx = max(len[X],len[Y]);
	
	if(vals.size()==2) return -1;
	
	if(vals[0]==len[X]&&vals[1]==len[Y]){
		mx = vals[2];
	}
	if(vals[0]==len[Y]&&vals[1]==len[X]){
		mx = vals[2];
	}
	
	return mx;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 108 ms 6408 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Halted 0 ms 0 KB -