답안 #70407

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70407 2018-08-22T19:45:25 Z Googal 컴퓨터 네트워크 (BOI14_network) C++14
0 / 100
163 ms 8860 KB
#include <iostream>
#include <vector>

#include "network.h"

using namespace std;

const int NMAX = 1e2;

vector < int > p[1 + NMAX];

void findRoute (int n, int a, int b) {

  int dist = ping(a, b);

  for(int i = 1; i <= n; i++)
    if (i != a)
      p[ping(a, i) + 1].push_back(i);

  for(int d = 1; d <= dist; d++) {
    bool ok = false;

    for(int i = 1; i < p[d].size(); i++) {
      if(ping(a, p[d][i]) == 0) {
        if(dist == d + ping(p[d][i], b)) {
          a = p[d][i];
          travelTo(a);
          ok = true;
          break;
        }
      }
    }

    if (ok == false) {
      a = p[d][0];
      travelTo(a);
    }
  }

  travelTo(b);
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:23:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 1; i < p[d].size(); i++) {
                    ~~^~~~~~~~~~~~~
grader.c: In function 'int main()':
grader.c:48:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d%d%d%d", &N, &a, &b, &M);
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
grader.c:51:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &distance[u][v]);
             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 163 ms 8476 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 153 ms 8476 KB Output is correct
2 Correct 37 ms 8476 KB Output is correct
3 Runtime error 128 ms 8540 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 122 ms 8540 KB Output is correct
2 Correct 30 ms 8540 KB Output is correct
3 Runtime error 119 ms 8576 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 112 ms 8696 KB Output is correct
2 Correct 28 ms 8696 KB Output is correct
3 Runtime error 121 ms 8860 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -