Submission #1105124

# Submission time Handle Problem Language Result Execution time Memory
1105124 2024-10-25T13:57:30 Z SteveBro Race (IOI11_race) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;
int mat[200001][2],v[200001],vc[1000001],p;
bool ok[200001];
vector < pair<int,int> > g[200001];
void divide(int nod)
{
    int nr=0;
    for(auto x : g[nod])
        if(!ok[x])
            nr++;
    if(!nr)
        return;

}
int best_path(int n,int k,int h[200001][2],int l[200001])
{
    int rez=-1,i;
    for(i=1;i<=n;i++)
    {
        g[h[i][0]].push_back(make_pair(h[i][1],l[i]));
        g[h[i][1]].push_back(make_pair(h[i][0],l[i]));
    }
    p=k;
    divide(1);
    return rez;
}
int main()
{
    int n,i,k;
    cin>>n>>k;
    for(i=1;i<=n;i++)
    {
        cin>>mat[i][0]>>mat[i][1];
    }
    for(i=1;i<=n;i++)
        cin>>v[i];
    cout<<best_path(n,k,mat,v);
    return 0;
}

Compilation message

race.cpp: In function 'void divide(int)':
race.cpp:11:15: error: no match for 'operator[]' (operand types are 'bool [200001]' and 'std::pair<int, int>')
   11 |         if(!ok[x])
      |               ^