#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 <= 2) return -1;
int idx = -1;
for (pii i : s) {
if (i.ss != X and i.ss != Y and min(X, Y) != 0) {
return max ({i.ff, mp[X], mp[Y]});
}
else if (i.ss != X and i.ss != Y) {
if (~idx) {
return cout << max ({i.ff, idx, mp[X], mp[Y]});
}
else idx = i.ff;
}
}
}
}
//#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:37:18: error: cannot convert 'std::basic_ostream<char>' to 'int' in return
37 | return cout << max ({i.ff, idx, mp[X], mp[Y]});
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| std::basic_ostream<char>