Submission #608749

# Submission time Handle Problem Language Result Execution time Memory
608749 2022-07-27T09:52:28 Z DeMen100ns Monster Game (JOI21_monster) C++17
Compilation error
0 ms 0 KB
/*
Author : DeMen100ns (a.k.a Vo Khac Trieu)
School : VNU-HCM High school for the Gifted
fuck you adhoc
*/

#include <monster.h>

namespace {

    bool f[N][N];
    int cnt[N];

};

std::vector<int> solve(int n)
{
    for(int i = 0; i < n; ++i){
        for(int j = 1; j < n; ++j){
            f[i][j] = Query(i, j);
            cnt[i] += f[i][j];
            cnt[j] += (!f[i][j]);
        }
    }
    std::vector <int> ans(N);
    int luu1 = -1, luu2 = -1;
    for(int i = 0; i < n; ++i){
        if (cnt[i] < n - 1){
            ans[i] = cnt[i] - 1;
        } else{
            if (luu1 == -1) luu1 = i;
            else luu2 = i;
        }
    }
    ans[luu1] = ans[luu2] = n - 1;
    if (f[luu1][luu2]) ans[luu1] = n - 2;
    else ans[luu2] = n - 2;

    return ans;
}

Compilation message

monster.cpp:11:12: error: 'N' was not declared in this scope
   11 |     bool f[N][N];
      |            ^
monster.cpp:11:15: error: 'N' was not declared in this scope
   11 |     bool f[N][N];
      |               ^
monster.cpp:12:13: error: 'N' was not declared in this scope
   12 |     int cnt[N];
      |             ^
monster.cpp: In function 'std::vector<int> solve(int)':
monster.cpp:20:13: error: 'f' was not declared in this scope
   20 |             f[i][j] = Query(i, j);
      |             ^
monster.cpp:21:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   21 |             cnt[i] += f[i][j];
      |             ^~~
      |             int
monster.cpp:25:27: error: 'N' was not declared in this scope
   25 |     std::vector <int> ans(N);
      |                           ^
monster.cpp:28:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   28 |         if (cnt[i] < n - 1){
      |             ^~~
      |             int
monster.cpp:36:9: error: 'f' was not declared in this scope
   36 |     if (f[luu1][luu2]) ans[luu1] = n - 2;
      |         ^