QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#737124#3550. Hoof and Brain_8_8_#Compile Error//C++231.6kb2024-11-12 14:41:272024-11-12 14:41:57

Judging History

This is the latest submission verdict.

  • [2024-11-12 14:41:57]
  • Judged
  • [2024-11-12 14:41:27]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = (int)5e3 + 12;

int n, m, s[N];
bool dp[N][N];
short t[N][N][2];

vector<int> gr[N];
void test() {
    cin >> n >> m;
    for(int i = 1; i <= m; i++) {
        int a, b;
        cin >> a >> b;
        s[a]++;
        gr[b].push_back(a);
    }
    for(int i = 1; i <= n; i++) {
        dp[i][i] = 1;
    }
    queue<pair<int, int>> f;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            if(g[i].empty() || g[j].empty()) {
                dp[i][j] = 1;
            }
        }
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            if(dp[i][j]) {
                f.push({i, j});
            } else {
                t[i][j][0] = (int)s[i];
                t[i][j][1] = (int)s[j];
            }
        }
    }
    while(!f.empty()) {
        auto [x, y] = f.front(); 
        f.pop();
        for(int to:gr[x]) {
            t[to][y][0]--;
            if(t[to][y][0] == 0 && !dp[to][y]) {
                dp[to][y] = 1;
                f.push({to, y});
            }
        }
        for(int to:gr[y]) {
            t[x][to][1]--;
            if(t[x][to][1] == 0 && !dp[x][to]) {
                dp[x][to] = 1;
                f.push({x, to});
            }
        }
    }
    int q;
    cin >> q;
    while(q--) {
        int x, y;
        cin >> x >> y;
        cout << (dp[x][y] ? 'B' : 'H');
    }
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int t = 1;
    // cin >> t;

    while(t--) 
        test();
}

詳細信息

answer.code: In function ‘void test()’:
answer.code:28:16: error: ‘g’ was not declared in this scope
   28 |             if(g[i].empty() || g[j].empty()) {
      |                ^