Submission #1041779

# Submission time Handle Problem Language Result Execution time Memory
1041779 2024-08-02T08:09:24 Z Halym2007 Swapping Cities (APIO20_swap) C++17
0 / 100
2000 ms 5204 KB
#include<bits/stdc++.h>
#include "swap.h"
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define sz size()
vector <int> V, U, W;
int subtask2 = 0, n, m;
void init(int N, int M, vector<int> U1, vector<int> V1, vector<int> W1) {
	n = N;m = M;V = V1;U = U1, W = W1;
	for (int i = 0; i < m; ++i) {
		if (U[i]) {
			subtask2 = 1;
			break;
		}
	}
}

int getMinimumFuelCapacity(int X, int Y) {
	if (!subtask2) {
		int jog = 0, tr = -1;
		for (int i = 0; i < m; ++i) {
			if (V[i] == X or V[i] == Y) {
				jog = max (jog, W[i]);
			}
			else {
				if (~tr) tr = min (tr, W[i]);
				else tr = W[i];
			}
		}
		if (~tr) return max (jog, tr);
		else return tr;
	}
	return 0;
}



//#include <cassert>
//#include <cstdio>
//
//#include <string>
//#include <vector>
//
//int main() {
//	freopen ("input.txt", "r", stdin);
//  int N, M;
//  assert(2 == scanf("%d %d", &N, &M));
//  
//  std::vector<int> U(M), V(M), W(M);
//  for (int i = 0; i < M; ++i) {
//    assert(3 == scanf("%d %d %d", &U[i], &V[i], &W[i]));
//  }
//
//  int Q;
//  assert(1 == scanf("%d", &Q));
//
//  std::vector<int> X(Q), Y(Q);
//  for (int i = 0; i < Q; ++i) {
//    assert(2 == scanf("%d %d", &X[i], &Y[i]));
//  }
//
//  init(N, M, U, V, W);
//  
//  std::vector<int> minimum_fuel_capacities(Q);
//  for (int i = 0; i < Q; ++i) {
//    minimum_fuel_capacities[i] = getMinimumFuelCapacity(X[i], Y[i]);
//  }
//
//  for (int i = 0; i < Q; ++i) {
//    printf("%d\n", minimum_fuel_capacities[i]);
//  }
//  
//  return 0;
//}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Execution timed out 2039 ms 5204 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -