답안 #841556

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
841556 2023-09-01T16:50:05 Z Lawliet 축구 경기장 (IOI23_soccer) C++17
1.5 / 100
261 ms 39972 KB
#include "soccer.h"
#include <bits/stdc++.h>
 
using namespace std;
 
bool checkIntervals(pair<int,int> a, pair<int,int> b)
{
    return (b.first <= a.first && a.second <= b.second);
}
 
bool isGood(int N, vector<vector<int>>& F)
{
    vector<pair<int,int>> intervals;
 
    for(int i = 0 ; i < N ; i++)
    {
        int numCells = 0;
        int minCell = N, maxCell = -1;
 
        for(int j = 0 ; j < N ; j++)
        {
            if( F[i][j] == 0 )
            {
                numCells++;
                minCell = min( minCell , j );
                maxCell = max( maxCell , j );
            }
        }
 
        if( numCells == 0 )
            continue;
 
        if( numCells != maxCell - minCell + 1 )
            return false;
 
        intervals.push_back( { minCell , maxCell } );
    }
 
    sort( intervals.begin() , intervals.end() , [&](pair<int,int> a, pair<int,int> b){
        return a.second - a.first + 1 < b.second - b.first + 1;
    });
 
    for(int i = 0 ; i + 1 < (int)intervals.size() ; i++)
        if( !checkIntervals( intervals[i] , intervals[i + 1] ) ) return false;
 
    return true;
}
 
int biggest_stadium(int N, vector<vector<int>> F)
{
    if( !isGood(N, F) )
        return -1;
 
    int sum = 0;
 
    for(int i = 0 ; i < N ; i++)
        for(int j = 0 ; j < N ; j++)
            sum += 1 - F[i][j];
 
    return sum;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 440 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 348 KB partial
7 Partially correct 1 ms 600 KB partial
8 Partially correct 17 ms 2908 KB partial
9 Partially correct 261 ms 39972 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 440 KB ok
3 Partially correct 0 ms 348 KB partial
4 Incorrect 0 ms 348 KB wrong
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 440 KB ok
4 Partially correct 0 ms 348 KB partial
5 Incorrect 0 ms 348 KB wrong
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 440 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 348 KB partial
7 Incorrect 0 ms 348 KB wrong
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 440 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 348 KB partial
7 Incorrect 0 ms 348 KB wrong
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 440 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Partially correct 0 ms 348 KB partial
8 Partially correct 1 ms 600 KB partial
9 Partially correct 17 ms 2908 KB partial
10 Partially correct 261 ms 39972 KB partial
11 Partially correct 0 ms 348 KB partial
12 Incorrect 0 ms 348 KB wrong
13 Halted 0 ms 0 KB -