Submission #250136

#TimeUsernameProblemLanguageResultExecution timeMemory
250136Kevin_Zhang_TWCop and Robber (BOI14_coprobber)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define MAX_N 500 const int inf = 1e9; // modify the following functions // you can define global variables and functions int dp[MAX_N][MAX_N]; int now, n; bool con[MAX_N][MAX_N]; int start(int n, bool A[MAX_N][MAX_N]) { for (int i = 0;i < n;++i) for (int j = 0;j < n;++j) dp[i][j] = A[i][j] ? 1 : inf, con[i][j] = A[i][j]; // for (int i = 0;i < n;++i) // for (int j = 0;j < n;++j) if (i != j) // assert(A[i][j]); for (int k = 0;k < n;++k) for (int i = 0;i < n;++i) for (int j = 0;j < n;++j) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]); return 0; // int res = 0; // for (int i = 0;i < n;++i) // if (dp[i][i] <= n) // res = max(res, dp[i][i]), cerr << dp[i][i] << '\n'; // if (res > 4) return -1; // // return 0; } int nextMove(int R) { if (con[now][R] || now == R) return now = R; int go = -1, dis = INT_MAX; for (int i = 0;i < n;++i) if (con[now][i]) { if (dp[i][R] < dis) dis = dp[i][R], go = i; } return now = go; } // don't modify the main function int main() { int N; cin >> N; bool A[MAX_N][MAX_N]; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { cin >> A[i][j]; } } int P = start(N,A); cout << P << endl; int R; cin >> R; while (true) { if (P == R) break; P = nextMove(R); cout << P << endl; if (P == R) break; cin >> R; } }

Compilation message (stderr)

/tmp/cce4LqKF.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cchBzH30.o:coprobber.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status