답안 #861680

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
861680 2023-10-16T16:15:52 Z faustaadp 축구 경기장 (IOI23_soccer) C++17
8 / 100
4500 ms 432 KB
#include "soccer.h"
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define pb push_back
ll b[2010][2010];
ll mx = 0, te;
vector<vector<int> > O, X;
ll cek(int N, std::vector<std::vector<int>> F)
{
    ll sum = 0;
    for(ll i = 0; i < N; i++)
    {
        for(ll j = 0; j < N; j++)
        {
            // cout << F[i][j];
            sum += (1 - F[i][j]);
        }
        // cout << "\n";
    }
    // cout << "\n";
    for(ll i = 0; i < N; i++)
        for(ll j = 0; j < N; j++)
        {
            if(F[i][j])continue;
            ll ha = 0;
            te++;
            for(ll k = i; k < N; k++)
            {
                if(F[k][j])break;
                for(ll l = j; l < N; l++)
                {
                    if(F[k][l])break;
                    ha += (b[k][l] != te);
                    b[k][l] = te;
                }
                for(ll l = j; l >= 0; l--)
                {
                    if(F[k][l])break;
                    ha += (b[k][l] != te);
                    b[k][l] = te;
                }
            }
            // cout << ha << "_\n";
            for(ll k = i; k >= 0; k--)
            {
                if(F[k][j])break;
                for(ll l = j; l < N; l++)
                {
                    if(F[k][l])break;
                    ha += (b[k][l] != te);
                    b[k][l] = te;
                }
                for(ll l = j; l >= 0; l--)
                {
                    if(F[k][l])break;
                    ha += (b[k][l] != te);
                    b[k][l] = te;
                }
            }

            for(ll k = j; k < N; k++)
            {
                if(F[i][k])break;
                for(ll l = i; l < N; l++)
                {
                    if(F[l][k])break;
                    ha += (b[l][k] != te);
                    b[l][k] = te;
                }
                for(ll l = i; l >= 0; l--)
                {
                    if(F[l][k])break;
                    ha += (b[l][k] != te);
                    b[l][k] = te;
                }
            }
            for(ll k = j; k >= 0; k--)
            {
                if(F[i][k])break;
                for(ll l = i; l < N; l++)
                {
                    if(F[l][k])break;
                    ha += (b[l][k] != te);
                    b[l][k] = te;
                }
                for(ll l = i; l >= 0; l--)
                {
                    if(F[l][k])break;
                    ha += (b[l][k] != te);
                    b[l][k] = te;
                }
            }
            // cout << ha << " "<< sum << "_\n";
            if(ha != sum)
                return 0;
        }
    // cout << sum << "_\n";
    return sum;
}
void jalan(ll i, ll j, ll N)
{
    if(i == N)
    {
        mx = max(mx, cek(N, X));
        return ;
    }
    ll nI = i;
    ll nJ = j + 1;
    if(nJ == N)
    {
        nI++;
        nJ = 0;
    }
    X[i][j] = 1;
    jalan(nI, nJ, N);
    if(!O[i][j])
    {
        X[i][j] = 0;
        jalan(nI, nJ, N);
    }
}
int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
    O = F;
    X = F;
    jalan(0, 0, N);
    return mx;
    // return cek(N, F);
    // return cek(N, F);
    // for(ll i = 0; i < N; i++)
    //     for(ll j = 0; j < N; j++)
    //     {
    //         if(F[i][j])
    //         {
    //             return N * N - min(i + 1, N - i) * min(j + 1, N - j);
    //         }
    //     }
    // return N * N;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1179 ms 432 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Execution timed out 4583 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 344 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 1 ms 348 KB ok
9 Correct 0 ms 344 KB ok
10 Correct 0 ms 344 KB ok
11 Correct 0 ms 344 KB ok
12 Correct 0 ms 348 KB ok
13 Correct 0 ms 348 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1179 ms 432 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 344 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 0 ms 348 KB ok
9 Correct 1 ms 348 KB ok
10 Correct 0 ms 344 KB ok
11 Correct 0 ms 344 KB ok
12 Correct 0 ms 344 KB ok
13 Correct 0 ms 348 KB ok
14 Correct 0 ms 348 KB ok
15 Execution timed out 4571 ms 348 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1179 ms 432 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Execution timed out 4583 ms 348 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1179 ms 432 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Execution timed out 4583 ms 348 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1179 ms 432 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Execution timed out 4583 ms 348 KB Time limit exceeded
5 Halted 0 ms 0 KB -