답안 #839801

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
839801 2023-08-30T16:35:48 Z mircea_007 축구 경기장 (IOI23_soccer) C++17
1.5 / 100
264 ms 31624 KB
#include <stdio.h>
#include <vector>

int biggest_stadium( int N, std::vector<std::vector<int>> F ){
  int nempty = 0, l, c, border, prev, minl, maxl, minc, maxc, max_fl, max_fc;

  std::vector<int> fl( N, 0 ), fc( N, 0 );

  minl = N;
  maxl = -1;
  minc = N;
  maxc = -1;
  for( l = 0 ; l < N ; l++ )
    for( c = 0 ; c < N ; c++ )
      if( !F[l][c] ){
        nempty++;
        fl[l]++;
        fc[c]++;

        minl = l < minl ? l : minl;
        maxl = l > maxl ? l : maxl;
        minc = c < minc ? c : minc;
        maxc = c > maxc ? c : maxc;
      }

  for( l = 0 ; l < N ; l++ ){
    prev = 1;
    border = 0;
    for( c = 0 ; c < N ; c++ ){
      if( F[l][c] != prev ){
        prev = F[l][c];
        border++;
      }
    }

    if( border > 2 )
      return 1;
  }

  for( c = 0 ; c < N ; c++ ){
    prev = 1;
    border = 0;
    for( l = 0 ; l < N ; l++ ){
      if( F[l][c] != prev ){
        prev = F[l][c];
        border++;
      }
    }

    if( border > 2 )
      return 1;
  }

  max_fl = max_fc = 0;
  for( l = 0 ; l < N ; l++ )
    max_fl = fl[l] > max_fl ? fl[l] : max_fl;
  for( c = 0 ; c < N ; c++ )
    max_fc = fc[c] > max_fc ? fc[c] : max_fc;

  if( maxl - minl + 1 != max_fl )
    return 1;

  if( maxc - minc + 1 != max_fc )
    return 1;

  return nempty;

  // ignore the rest

  // since initial condition is met now we can focus on couting reachable pairs

  for( l = 0 ; l < N ; l++ )
    for( c = 0 ; c < N ; c++ )
      if( !F[l][c] ){
      }

  long long max_reachable = nempty;
  max_reachable *= (nempty - 1);
  max_reachable >>= 1; // (nempty choose 2)

  long long reachable_pairs = 0;

  for( l = 0 ; l < N ; l++ )
    for( c = 0 ; c < N ; c++ )
      if( !F[l][c] )
        reachable_pairs += ((long long)fl[l]) * fc[c];

  // all that is left is to count the pairs which allow 2 paths and remove them from the count

  reachable_pairs -= nempty;
  
  return reachable_pairs == max_reachable ? nempty : 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB ok
2 Correct 1 ms 212 KB ok
3 Correct 0 ms 212 KB ok
4 Correct 0 ms 212 KB ok
5 Correct 0 ms 212 KB ok
6 Partially correct 0 ms 212 KB partial
7 Partially correct 1 ms 340 KB partial
8 Partially correct 16 ms 2260 KB partial
9 Partially correct 264 ms 31624 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB ok
2 Correct 1 ms 212 KB ok
3 Partially correct 0 ms 212 KB partial
4 Partially correct 0 ms 212 KB partial
5 Partially correct 0 ms 212 KB partial
6 Partially correct 0 ms 212 KB partial
7 Incorrect 0 ms 212 KB wrong
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB partial
2 Correct 1 ms 212 KB ok
3 Correct 1 ms 212 KB ok
4 Partially correct 0 ms 212 KB partial
5 Partially correct 0 ms 212 KB partial
6 Partially correct 0 ms 212 KB partial
7 Partially correct 0 ms 212 KB partial
8 Incorrect 0 ms 212 KB wrong
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB partial
2 Correct 1 ms 212 KB ok
3 Correct 1 ms 212 KB ok
4 Correct 0 ms 212 KB ok
5 Correct 0 ms 212 KB ok
6 Partially correct 0 ms 212 KB partial
7 Partially correct 0 ms 212 KB partial
8 Partially correct 0 ms 212 KB partial
9 Partially correct 0 ms 212 KB partial
10 Incorrect 0 ms 212 KB wrong
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB partial
2 Correct 1 ms 212 KB ok
3 Correct 1 ms 212 KB ok
4 Correct 0 ms 212 KB ok
5 Correct 0 ms 212 KB ok
6 Partially correct 0 ms 212 KB partial
7 Partially correct 0 ms 212 KB partial
8 Partially correct 0 ms 212 KB partial
9 Partially correct 0 ms 212 KB partial
10 Incorrect 0 ms 212 KB wrong
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB partial
2 Correct 1 ms 212 KB ok
3 Correct 1 ms 212 KB ok
4 Correct 0 ms 212 KB ok
5 Correct 0 ms 212 KB ok
6 Correct 0 ms 212 KB ok
7 Partially correct 0 ms 212 KB partial
8 Partially correct 1 ms 340 KB partial
9 Partially correct 16 ms 2260 KB partial
10 Partially correct 264 ms 31624 KB partial
11 Partially correct 0 ms 212 KB partial
12 Partially correct 0 ms 212 KB partial
13 Partially correct 0 ms 212 KB partial
14 Partially correct 0 ms 212 KB partial
15 Incorrect 0 ms 212 KB wrong
16 Halted 0 ms 0 KB -