Submission #406002

# Submission time Handle Problem Language Result Execution time Memory
406002 2021-05-17T06:25:36 Z Maqsut_03 Swapping Cities (APIO20_swap) C++17
7 / 100
138 ms 14976 KB
#include "swap.h"
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>

#define ll int
#define pl pair<ll, ll> 
#define llv vector<ll>
#define pb push_back
#define ppb(x, y) push_back({x, y})
#define pv vector<pl>
#define sz size()
#define ss second
#define ff first

using namespace std;
const int N = 2 * 1e5 + 3;

bool f = 0, f1 = 1;
pv v;
llv w[N];
int a[N], b, k = 0;

void init(int N, int M, vector<int> U, vector<int> V, vector<int> W) 
{
	if (N > 3) f = 1;
	for (int i=0; i<M; i++) v.ppb(W[i], V[i]);
	sort(v.begin(), v.end());
	b = v[2].ff;
	for (int i=0; i<M; i++) a[V[i]] = W[i];
	
	for (int i=0; i<M; i++)
	{
		w[V[i]].pb(U[i]);
		w[U[i]].pb(V[i]);
		k = max(k, W[i]);
	}
	for (int i=0; i<N; i++) f1 &= (w[i].sz == 2);
	return ;
}
int getMinimumFuelCapacity(int X, int Y) 
{
	if (f1) return k;
	if (f)
	    return max({b, a[X], a[Y]});
	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 Incorrect 3 ms 4940 KB Output isn't correct
5 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 120 ms 14704 KB Output is correct
4 Correct 126 ms 14808 KB Output is correct
5 Correct 128 ms 14956 KB Output is correct
6 Correct 124 ms 14772 KB Output is correct
7 Correct 138 ms 14976 KB Output is correct
8 Correct 122 ms 14612 KB Output is correct
9 Correct 125 ms 14784 KB Output is correct
10 Correct 120 ms 14600 KB Output is 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 Incorrect 3 ms 4940 KB Output isn't correct
5 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 Incorrect 3 ms 4940 KB Output isn't correct
5 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 Incorrect 3 ms 4940 KB Output isn't correct
5 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 Incorrect 3 ms 4940 KB Output isn't correct
5 Halted 0 ms 0 KB -