답안 #1041784

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041784 2024-08-02T08:18:19 Z Halym2007 자매 도시 (APIO20_swap) C++17
0 / 100
1 ms 344 KB
#include<bits/stdc++.h>
//#include "swap.h"
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define sz size()
#define pii pair <int, int>
vector <int> V, U, W;
int subtask2 = 0, n, m;

set <pii> s;
map <int, int> mp;

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;
		}
		s.insert ({W[i], V[i]});
		mp[V[i]] = W[i];
	}
}

int getMinimumFuelCapacity(int X, int Y) {
	if (!subtask2) {
		if (m == 1) return -1;
		for (pii i : s) {
			if (i.ss != X and i.ss != Y) {
				return max ({i.ff, mp[X], mp[Y]});
			} 
		}
	}
}



//#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;
//}

Compilation message

swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -