Submission #964451

# Submission time Handle Problem Language Result Execution time Memory
964451 2024-04-16T22:51:37 Z TAhmed33 Werewolf (IOI18_werewolf) C++17
Compilation error
0 ms 0 KB
#include "werewolf.h"
#include "grader.cpp"
using namespace std;
vector<int> check_validity (int N, vector <int> X, vector<int> Y,
                                vector<int> S, vector<int> E,
                                vector<int> L, vector<int> R) {
    n = N; m = (int)X.size(); q = S.size();
    int dp[n][n], dq[n][n]; //min edge, max edge
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            dp[i][j] = -1e9; dq[i][j] = 1e9;
        }
        dp[i][i] = dq[i][i] = i;
    }
    for (int i = 0; i < m; i++) {
        dp[X[i]][Y[i]] = dp[Y[i]][X[i]] = min(Y[i], X[i]);
        dq[X[i]][Y[i]] = dq[Y[i]][X[i]] = max(Y[i], X[i]);
    }
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                dp[i][j] = max(dp[i][j], min(dp[i][k], dp[k][j]));
                dq[i][j] = min(dq[i][j], max(dq[i][k], dq[k][j]));
            }
        }
    }
    vector <int> ret;
    for (int i = 0; i < q; i++) {
        int flag = 0;
        int a = S[i], b = E[i];
        for (int j = 0; j < n; j++) {
            flag |= dp[a][j] >= L[i] && dq[j][b] <= R[i];
        }
        ret.push_back(flag);
    }
    return ret;
}   

Compilation message

werewolf.cpp: In function 'std::vector<int> check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:7:5: error: 'n' was not declared in this scope
    7 |     n = N; m = (int)X.size(); q = S.size();
      |     ^
werewolf.cpp:7:12: error: 'm' was not declared in this scope
    7 |     n = N; m = (int)X.size(); q = S.size();
      |            ^
werewolf.cpp:7:31: error: 'q' was not declared in this scope
    7 |     n = N; m = (int)X.size(); q = S.size();
      |                               ^
werewolf.cpp:11:13: error: 'dp' was not declared in this scope
   11 |             dp[i][j] = -1e9; dq[i][j] = 1e9;
      |             ^~
werewolf.cpp:11:30: error: 'dq' was not declared in this scope
   11 |             dp[i][j] = -1e9; dq[i][j] = 1e9;
      |                              ^~
werewolf.cpp:13:9: error: 'dp' was not declared in this scope
   13 |         dp[i][i] = dq[i][i] = i;
      |         ^~
werewolf.cpp:13:20: error: 'dq' was not declared in this scope
   13 |         dp[i][i] = dq[i][i] = i;
      |                    ^~
werewolf.cpp:16:9: error: 'dp' was not declared in this scope
   16 |         dp[X[i]][Y[i]] = dp[Y[i]][X[i]] = min(Y[i], X[i]);
      |         ^~
werewolf.cpp:17:9: error: 'dq' was not declared in this scope
   17 |         dq[X[i]][Y[i]] = dq[Y[i]][X[i]] = max(Y[i], X[i]);
      |         ^~
werewolf.cpp:22:17: error: 'dp' was not declared in this scope
   22 |                 dp[i][j] = max(dp[i][j], min(dp[i][k], dp[k][j]));
      |                 ^~
werewolf.cpp:23:17: error: 'dq' was not declared in this scope
   23 |                 dq[i][j] = min(dq[i][j], max(dq[i][k], dq[k][j]));
      |                 ^~
werewolf.cpp:32:21: error: 'dp' was not declared in this scope
   32 |             flag |= dp[a][j] >= L[i] && dq[j][b] <= R[i];
      |                     ^~
werewolf.cpp:32:41: error: 'dq' was not declared in this scope
   32 |             flag |= dp[a][j] >= L[i] && dq[j][b] <= R[i];
      |                                         ^~