제출 #1281225

#제출 시각아이디문제언어결과실행 시간메모리
1281225repmann철로 (IOI14_rail)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int N; int DIST[5000][5000]; //int getDistance(int i, int j) //{ // cout << i << ' ' << j << '\n'; // int ret; // cin >> ret; // return ret; //} void findLocation(int n, int location0, int location[], int stype[]) { N = n; stype[0] = 1; location[0] = location0; vector <pair <int, int>> V; for(int i = 1; i < N; i++) { DIST[0][i] = DIST[i][0] = getDistance(0, i); V.push_back({DIST[0][i], i}); } sort(V.begin(), V.end()); int d = V.begin()->second; stype[d] = 2; location[d] = location[0] + V.begin()->first; for(int i = 1; i < N; i++) { if(i == d) continue; DIST[d][i] = DIST[i][d] = getDistance(d, i); } for(int i = 1; i < N; i++) { if(i == d) continue; if(DIST[0][i] == (DIST[0][d] + DIST[d][i])) { stype[i] = 1; location[i] = location[d] - DIST[d][i]; } else { stype[i] = 2; location[i] = location[0] + DIST[0][i]; } } return; } //int main() //{ // int n, location0; // cin >> n >> location0; // int location[n], stype[n]; // findLocation(n, location0, location, stype); // for(int i = 0; i < n; i++) cout << location[i] << " \n"[i == (n - 1)]; // for(int i = 0; i < n; i++) cout << stype[i] << " \n"[i == (n - 1)]; // return 0; //}

컴파일 시 표준 에러 (stderr) 메시지

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:20:31: error: 'getDistance' was not declared in this scope
   20 |     DIST[0][i] = DIST[i][0] = getDistance(0, i);
      |                               ^~~~~~~~~~~
rail.cpp:30:31: error: 'getDistance' was not declared in this scope
   30 |     DIST[d][i] = DIST[i][d] = getDistance(d, i);
      |                               ^~~~~~~~~~~