답안 #537685

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
537685 2022-03-15T11:23:25 Z groshi 기지국 (IOI20_stations) C++17
0 / 100
2 ms 456 KB
#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]);
}
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:12:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     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:27:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(int i=0;i<u.size();i++)
      |                 ~^~~~~~~~~
stations.cpp:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
   38 | }
      | ^
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:41:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for(int i=0;i<c.size();i++)
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 412 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 420 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 440 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -