답안 #993808

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
993808 2024-06-06T12:48:08 Z stdfloat 축구 경기장 (IOI23_soccer) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "soccer.h"
#include "grader.cpp"
using namespace std;
 
int n, mx;
 
vector<vector<int>> a, v;
 
void f(int x) {
    if (x == n * n) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (!v[i][j]) continue;

                vector<vector<bool>> vis(n, vector<bool>(n));
                vis[i][j] = true;
                for (int z = 0; z < 2; z++) {
                    vector<vector<bool>> vis2(n, vector<bool>(n));
                    for (int k = 0; k < n; k++) {
                        for (int l = 0; l < n; l++) {
                            if (!vis[k][l]) continue;
 
                            for (int m = l - 1; m >= 0 && v[k][m]; m--)
                                vis2[k][m] = true;
                            for (int m = l + 1; m < n && v[k][m]; m++)
                                vis2[k][m] = true;
 
                            for (int m = k - 1; m >= 0 && v[m][l]; m--)
                                vis2[m][l] = true;
                            for (int m = k + 1; m < n && v[m][l]; m++)
                                vis2[m][l] = true;
                        }
                    }

                    for (int k = 0; k < n; k++) {
                        for (int l = 0; l < n; l++)
                            if (vis2[k][l]) vis[k][l] = true;
                    }
                }
 
                for (int k = 0; k < n; k++) {
                    for (int l = 0; l < n; l++)
                        if (v[k][l] && !vis[k][l]) return;
                }
            }
        }
 
        int cnt = 0;
        for (auto i : v)
            cnt += count(i.begin(), i.end(), 1);

        mx = max(mx, cnt);
 
        return;
    }
 
    for (int i = 0; i < 2; i++) {
        if (i && a[x / n][x % n]) return;

        v[x / n][x % n] = i;
        f(x + 1);
    }
}

int biggest_stadium(int N, vector<vector<int>> F) {
    n = N; a = F;
 
    int cnt = 0;
    for (auto i : a)
        cnt += count(i.begin(), i.end(), 1);
 
    if (!cnt) return n * n;
    else if (cnt == 1) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (a[i][j] == 1)
                    return n * n - min({(n - i) * (n - j), (n - i) * (j + 1), (i + 1) * (n - j), (i + 1) * (j + 1)});
            }
        }
    }

    if (n < 4) {
        v.assign(n, vector<int>(n));
        f(0);
     
        return mx;
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++)
            if (a[i][j] && 2 < ((i && !a[i - 1][j]) + (i + 1 < n && !a[i + 1][j]) + (j && !a[i][j - 1]) + (j + 1 < n && !a[i][j + 1]))) return 0;
    }

    return n * n - cnt;
}

Compilation message

/usr/bin/ld: /tmp/cc37iL6v.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccT5zV6v.o:soccer.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status