Submission #961346

# Submission time Handle Problem Language Result Execution time Memory
961346 2024-04-11T21:59:15 Z Mohamed_Kachef06 Swapping Cities (APIO20_swap) C++17
Compilation error
0 ms 0 KB
#include "swap.h"

#ifndef ONLINE_JUDGE
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;

map<pair<int , int> , int> mp;


void init(int N, int M,
          std::vector<int> U, std::vector<int> V, std::vector<int> W) {
      for (int i = 0 ; i < N ; i++){
        mp[{U[i] , V[i]}] = W[i];
      }     
}

int getMinimumFuelCapacity(int X, int Y) {
  if (X == 0) return -1;
  else return max({mp[{0 , Y}]} , mp[{0 , X}]);
}

Compilation message

In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/vector:60,
                 from swap.h:1,
                 from swap.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = const int*; _Iterator2 = const int*; _Compare = int]':
/usr/include/c++/10/bits/stl_algo.h:5700:12:   required from 'constexpr _ForwardIterator std::__max_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = const int*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<int>]'
/usr/include/c++/10/bits/stl_algo.h:5751:43:   required from 'constexpr _FIter std::max_element(_FIter, _FIter, _Compare) [with _FIter = const int*; _Compare = int]'
/usr/include/c++/10/bits/stl_algo.h:3487:31:   required from 'constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare) [with _Tp = int; _Compare = int]'
swap.cpp:21:46:   required from here
/usr/include/c++/10/bits/predefined_ops.h:156:30: error: expression cannot be used as a function
  156 |         { return bool(_M_comp(*__it1, *__it2)); }
      |                       ~~~~~~~^~~~~~~~~~~~~~~~