Submission #517075

# Submission time Handle Problem Language Result Execution time Memory
517075 2022-01-22T13:24:05 Z Sirapetch Stations (IOI20_stations) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

vector <int> path[1111];
queue <int> walk;
int pass[1111];
vector <int> label;

vector <int> label(int n, int k, vector<int> u, vector<int> v)
{
    label.clear();
    int i,x;
    for(i=0;i<n;i++)
    {
        pass[i]=0;
        label.push_back(0);
    }
    for(i=0;i<u.size();i++)
    {
        path[u[i]].push_back(v[i]);
        path[v[i]].push_back(u[i]);
    }
    walk.push(0);
    x=0;
    while(!walk.empty())
    {
        i=walk.front();
        if(pass[i]==1) continue;
        pass[i]=1;
        label[i]=x;
        x++;
        for(auto a:path[i])
        {
            walk.push(a);
        }
    }
    return label;
}

int find_next_station(int s, int t, vector<int> c)
{
    if(s<t) return s+1;
    else return s-1;
}

Compilation message

stations.cpp:9:62: error: 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)' redeclared as different kind of entity
    9 | vector <int> label(int n, int k, vector<int> u, vector<int> v)
      |                                                              ^
stations.cpp:7:14: note: previous declaration 'std::vector<int> label'
    7 | vector <int> label;
      |              ^~~~~
stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:18:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(i=0;i<u.size();i++)
      |             ~^~~~~~~~~