답안 #38100

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
38100 2018-01-01T06:29:00 Z funcsr 이상적인 도시 (IOI12_city) C++14
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <vector>
#include <set>
#include <cassert>
#include <queue>
#include <map>
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(xs) xs.begin(), xs.end()
#define pb push_back
#define _1 first
#define _2 second
#define INF 1145141919
#define MOD 1000000000
using namespace std;
int DX[4] = {-1, 0, 1, 0};
int DY[4] = {0, -1, 0, 1};

typedef pair<int, int> P;
int mp[2010][2010];
int D[2000][2000];
int DistanceSum(int N, int *X, int *Y) {
  if (N > 2000) abort();
  int mx = *min_element(X, X+N), my = *min_element(Y, Y+N);
  mx -= 5, my -= 5;
  rep(i, N) X[i] -= mx, Y[i] -= my;
  rep(i, 2010) rep(j, 2010) mp[i][j] = -1;
  rep(i, N) mp[X[i]][Y[i]] = i;
  rep(i, N) rep(j, N) D[i][j] = INF;
  rep(s, N) {
    queue<int> q;
    q.push(s);
    D[s][s] = 0;
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      rep(k, 4) {
        int t = mp[X[x]+DX[k]][Y[x]+DY[k]];
        if (t != -1 && D[s][t] == INF) {
          D[s][t] = D[s][x]+1;
          q.push(t);
        }
      }
    }
  }
  int s = 0;
  rep(i, N) rep(j, i) s = (s + D[i][j]) % MOD;
  return s;
}

Compilation message

city.cpp: In function 'int DistanceSum(int, int*, int*)':
city.cpp:23:31: error: 'min_element' was not declared in this scope
   int mx = *min_element(X, X+N), my = *min_element(Y, Y+N);
                               ^
city.cpp:24:12: error: 'my' was not declared in this scope
   mx -= 5, my -= 5;
            ^