Submission #415011

# Submission time Handle Problem Language Result Execution time Memory
415011 2021-05-31T12:27:40 Z MeGustaElArroz23 Shortcut (IOI16_shortcut) C++14
Compilation error
0 ms 0 KB
#include <cstdio>
#include <cassert>
#include "shortcut.h"
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pii;
typedef vector<pii> vii;
typedef vector<vii> vvii;

ll find_shortcut(int n, vi l, vi d, int c)
{
    vvii conexiones(2*n);
    for (int i=0;i<n-1;i++){
        conexiones[i].push_back(pii{l[i],i+1});
        conexiones[i+1].push_back(pii{l[i],i});
    }
    for (int i=0;i<n;i++){
        conexiones[i].push_back(pii{d[i],i+n});
        conexiones[n+i].push_back(pii{d[i],i});
    }
    ll mejor=INF;
    for (int i=0;i<n;i++){
        for (int j=i+1;j<n;j++){
            vvii conex=conexiones;
            conex[i].push_back(pii{c,j});
            conex[j].push_back(pii){c,i};
            ll mej=0;
            for (int v=n;v<2*n;v++){
                vector<bool> porvisitar(2*n,true);
                priority_queue<pii> cola;
                cola.push(pii{0,v});
                while (cola.size()){
                    pii x=cola.front();
                    cola.pop();
                    if (porvisitar[x.second]){
                        mej=min(mej,-x.first);
                        for (pii y:conex[x]){
                            cola.push(pii{x.first-y.first,y.second});
                        }
                    }
                }
            }
            mejor=min(mejor,mej);
        }
    }
    return mejor;
}

Compilation message

shortcut.cpp: In function 'll find_shortcut(int, vi, vi, int)':
shortcut.cpp:26:14: error: 'INF' was not declared in this scope
   26 |     ll mejor=INF;
      |              ^~~
shortcut.cpp:31:35: error: expected primary-expression before ')' token
   31 |             conex[j].push_back(pii){c,i};
      |                                   ^
shortcut.cpp:38:32: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   38 |                     pii x=cola.front();
      |                                ^~~~~
shortcut.cpp:42:41: error: no match for 'operator[]' (operand types are 'vvii' {aka 'std::vector<std::vector<std::pair<long long int, long long int> > >'} and 'pii' {aka 'std::pair<long long int, long long int>'})
   42 |                         for (pii y:conex[x]){
      |                                         ^
In file included from /usr/include/c++/10/vector:67,
                 from shortcut.h:2,
                 from shortcut.cpp:3:
/usr/include/c++/10/bits/stl_vector.h:1043:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::vector<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::vector<std::pair<long long int, long long int> > >; std::vector<_Tp, _Alloc>::reference = std::vector<std::pair<long long int, long long int> >&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
 1043 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1043:28: note:   no known conversion for argument 1 from 'pii' {aka 'std::pair<long long int, long long int>'} to 'std::vector<std::vector<std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'}
 1043 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1061:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = std::vector<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::vector<std::pair<long long int, long long int> > >; std::vector<_Tp, _Alloc>::const_reference = const std::vector<std::pair<long long int, long long int> >&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
 1061 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1061:28: note:   no known conversion for argument 1 from 'pii' {aka 'std::pair<long long int, long long int>'} to 'std::vector<std::vector<std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'}
 1061 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~