답안 #81052

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
81052 2018-10-23T15:52:21 Z xiaowuc1 컴퓨터 네트워크 (BOI14_network) C++14
0 / 100
128 ms 4600 KB
#include <bits/stdc++.h>
#include "network.h"

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);

ios_base::sync_with_stdio(false);
cin.tie(NULL);
*/
using namespace std;

const double PI = 2 * acos(0);

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<int, ll> pill;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef vector<vector<ll>> matrix;

map<pii, int> dp;
int dist(int a, int b) {
  pii key = {min(a, b), max(a, b)};
  if(!dp.count(key)) {
    dp[key] = ping(a, b) + 1;
  }
  return dp[key];
}

bool used[1005];
void findRoute(int n, int a, int b) {
  dp.clear();
  memset(used, 0, sizeof(used));
  stack<pii> q;
  q.push({a, b});
  used[a] = true;
  used[b] = true;
  while(!q.empty()) {
    pii curr = q.top();
    q.pop();
    if(dist(curr.first, curr.second) == 1) {
      travelTo(curr.second);
      continue;
    }
    for(int k = 1; k <= n; k++) {
      if(used[k]) continue;
      used[k] = true;
      if(dist(a, k) + dist(k, b) == dist(a, b)) {
        q.push({k, b});
        q.push({a, k});
        break;
      }
    }
  }
}

Compilation message

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 Incorrect 128 ms 4472 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 117 ms 4480 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 119 ms 4480 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 114 ms 4600 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -