203092026-01-06 12:39:17hunzombiBináris Sakkcpp17Forditási hiba
#include <bits/stdc++.h>
using namespace std;

const long long MOD = 1e9 + 7;

int r, c, n;
vector<pair<int, int>> nodes;
vector<vector<int>> graph;

dfs1(int node, vector<bool>& sz) {
    sz[node] = true;
    for (int next : graph[node]) {
        if (!sz[next]) {
            dfs1(next, sz);
        }
    }
}

int main()
{
    cin >> r >> c >> n;
    graph.assign(n + 1, vector<int>(0));
    for (int i=1; i <= n; i++) {
        int u, v;
        cin >> u >> v;
        for (int j = 0; j < nodes.size(); j++) {
            pair<int, int> node = nodes[j];
            int x = node.first, y = node.second;
            if (u == x || v == y || abs(x - y) == abs(u - v) || x + y == u + v) {
                graph[i].push_back(j + 1);
                graph[j + 1].push_back(i);
            }
        }
        nodes.push_back({u, v});
    }
    long long ans = 0;
    vector<bool> sz(n + 1, false);
    for (int i=1; i <= n; i++) {
        if (!sz[i]) {
            dfs1(i, sz);
            ans++;
        }
    }

    long long res = 1;

    while (ans > 0) {
        res = (res * 2) % MOD;
        ans--;
    }

    cout << res << '\n';

    return 0;
}
Forditási hiba
open /var/local/lib/isolate/434/box/a.out: no such file or directory
main.cpp:10:1: error: ISO C++ forbids declaration of 'dfs1' with no type [-fpermissive]
   10 | dfs1(int node, vector<bool>& sz) {
      | ^~~~
main.cpp: In function 'int dfs1(int, std::vector<bool>&)':
main.cpp:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
   17 | }
      | ^