답안 #1064827

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1064827 2024-08-18T18:16:04 Z Osplei 기지국 (IOI20_stations) C++17
0 / 100
1450 ms 1964 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

#define pb push_back

bool bfs (int nodo, int obj){
  bool visto[1000005];
  queue <int> q;

  for (int i = 0; i < 1000005; i++) visto[i] = false;

  q.push(nodo);

  while (!q.empty()){
    int act = q.front();
    if (act == obj) return true;
    q.pop();

    if (act > 1000) continue;

    if (visto[act] == true) continue;

    visto[act] = true;

    if (act != 0) q.push((act - 1) / 2);
    q.push((act * 2) + 1);
    q.push((act * 2) + 2);
  }

  return false;
}

vector <int> label(int n, int k, vector <int> u, vector <int> v) {

  for (int i = 0; i < u.size(); i++) {
    int a = u[i], b = v[i];
  }

  vector <int> labels;

  for (int i = 0; i < n; i++) labels.pb(i);

  return labels;
	
}

int find_next_station(int s, int t, vector <int> c) {

  if (c.size() == 1) return c[0];

  for (int i = 0; i < c.size(); i++) {
    if (bfs(c[i], t) == true) return c[i];
  }

}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:37:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |   for (int i = 0; i < u.size(); i++) {
      |                   ~~^~~~~~~~~~
stations.cpp:38:9: warning: unused variable 'a' [-Wunused-variable]
   38 |     int a = u[i], b = v[i];
      |         ^
stations.cpp:38:19: warning: unused variable 'b' [-Wunused-variable]
   38 |     int a = u[i], b = v[i];
      |                   ^
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:53:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |   for (int i = 0; i < c.size(); i++) {
      |                   ~~^~~~~~~~~~
stations.cpp:57:1: warning: control reaches end of non-void function [-Wreturn-type]
   57 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1450 ms 1708 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1053 ms 1964 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1422 ms 1740 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 657 ms 684 KB Output is correct
2 Incorrect 1035 ms 1708 KB Wrong query response.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1438 ms 1744 KB Wrong query response.
2 Halted 0 ms 0 KB -