답안 #842110

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
842110 2023-09-02T12:11:06 Z Tenis0206 축구 경기장 (IOI23_soccer) C++17
1.5 / 100
229 ms 47440 KB
#include <bits/stdc++.h>
#include "soccer.h"

using namespace std;

const int nmax = 2e3;

int n;

int a[nmax + 5][nmax + 5];

int st[nmax + 5], dr[nmax + 5];

bool verif()
{
    for(int i=1; i<=n; i++)
    {
        st[i] = dr[i] = 0;
    }
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=n; j++)
        {
            if(a[i][j]==0 && a[i][j - 1]==1)
            {
                if(st[i])
                {
                    return false;
                }
                st[i] = j;
            }
            if(a[i][j]==0)
            {
                dr[i] = j;
            }
        }
    }
    bool desc_st = false, desc_dr = false, start = false;
    for(int i=2; i<=n; i++)
    {
        if(st[i] && !st[i-1] && start)
        {
            return false;
        }
        if(st[i])
        {
            start = true;

            if(st[i - 1] && st[i] < st[i - 1] && desc_st)
            {
                return false;
            }
            if(st[i - 1] && st[i] > st[i - 1])
            {
                desc_st = true;
            }

            if(dr[i - 1] && dr[i] > dr[i - 1] && desc_dr)
            {
                return false;
            }
            if(dr[i - 1] && dr[i] < dr[i - 1])
            {
                desc_dr = true;
            }
        }
    }
    return true;
}

int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
    n = N;
    int nre = 0;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=n; j++)
        {
            a[i][j] = F[i - 1][j - 1];
            nre += (1 - a[i][j]);
        }
    }
    for(int i=0; i<=n; i++)
    {
        a[i][0] = a[0][i] = a[i][n + 1] = a[n + 1][i] = 1;
    }
    bool ok = verif();
    if(ok)
    {
        return nre;
    }
    return nre - 1;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB ok
2 Correct 1 ms 344 KB ok
3 Correct 1 ms 344 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 344 KB ok
6 Partially correct 0 ms 344 KB partial
7 Partially correct 1 ms 2648 KB partial
8 Partially correct 15 ms 6816 KB partial
9 Partially correct 229 ms 47440 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB ok
2 Correct 1 ms 344 KB ok
3 Correct 1 ms 600 KB ok
4 Correct 0 ms 344 KB ok
5 Incorrect 0 ms 344 KB wrong
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 1 ms 344 KB ok
4 Correct 1 ms 600 KB ok
5 Correct 0 ms 344 KB ok
6 Incorrect 0 ms 344 KB wrong
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 1 ms 344 KB ok
4 Correct 1 ms 344 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 1 ms 600 KB ok
7 Correct 0 ms 344 KB ok
8 Incorrect 0 ms 344 KB wrong
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 1 ms 344 KB ok
4 Correct 1 ms 344 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 1 ms 600 KB ok
7 Correct 0 ms 344 KB ok
8 Incorrect 0 ms 344 KB wrong
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 1 ms 344 KB ok
4 Correct 1 ms 344 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 344 KB ok
7 Partially correct 0 ms 344 KB partial
8 Partially correct 1 ms 2648 KB partial
9 Partially correct 15 ms 6816 KB partial
10 Partially correct 229 ms 47440 KB partial
11 Correct 1 ms 600 KB ok
12 Correct 0 ms 344 KB ok
13 Incorrect 0 ms 344 KB wrong
14 Halted 0 ms 0 KB -