Submission #537689

# Submission time Handle Problem Language Result Execution time Memory
537689 2022-03-15T11:29:07 Z groshi Stations (IOI20_stations) C++17
0 / 100
716 ms 544 KB
#include<iostream>
#include<vector>
#include<algorithm>
#include<stations.h>
using namespace std;
int kiedy=1;
int odw[1010];
vector<int> Q[1010];
void dfs(int x)
{
    odw[x]=kiedy;
    kiedy++;
    for(int i=0;i<Q[x].size();i++)
    {
        int pom=Q[x][i];
        if(odw[pom]!=0)
            continue;
        dfs(pom);
    }
}
vector<int> label(int n,int k,vector<int> u,vector<int> v)
{
    for(int i=0;i<=n+3;i++)
        odw[i]=0;
    for(int i=0;i<=n+3;i++)
        Q[i].clear();
    kiedy=1;
    for(int i=0;i<u.size();i++)
    {
        u[i]++;
        v[i]++;
        Q[u[i]].push_back(v[i]);
        Q[v[i]].push_back(u[i]);
    }
    dfs(1);
    vector<int> wypisz;
    for(int i=1;i<=n;i++)
        wypisz.push_back(odw[i]);
    return wypisz;
}
int find_next_station(int s,int t,vector<int> c)
{
    for(int i=0;i<c.size();i++)
        if(min(c[i],s)<=t && max(c[i],s)>=t)
        return c[i];
    return c.back();
}

Compilation message

stations.cpp: In function 'void dfs(int)':
stations.cpp:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i=0;i<Q[x].size();i++)
      |                 ~^~~~~~~~~~~~
stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:28:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i=0;i<u.size();i++)
      |                 ~^~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:43:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     for(int i=0;i<c.size();i++)
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 378 ms 544 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 387 ms 544 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 441 ms 520 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 716 ms 528 KB Output is correct
2 Correct 572 ms 420 KB Output is correct
3 Incorrect 531 ms 544 KB Wrong query response.
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 481 ms 544 KB Wrong query response.
2 Halted 0 ms 0 KB -