답안 #959530

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
959530 2024-04-08T11:56:25 Z nguyentunglam 축구 경기장 (IOI23_soccer) C++17
3.5 / 100
294 ms 71364 KB
#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;

const int N = 2010;

int n;

int a[N][N];

vector<int> arr[N];

int check_valid() {
  for(int col = 0; col < n; col++) {
    for(int row = 0; row < n; row++) if (a[row][col] == 0) arr[col].push_back(row);
  }
  int st = 0;
  while (st < n && arr[st].empty()) st++;
  if (st == n) return 0;
  bool tie = 0;
  int prel = 0, prer = 0, cnt = 0, _cnt = 0;
  for(int i = st; i < n; i++) {
    if (arr[i].empty()) break;
    int l = arr[i][0], r = arr[i].back();
    cnt += arr[i].size();
    if (r - l + 1 != arr[i].size()) return 0;
    if (i == st) {
      prel = l;
      prer = r;
      continue;
    }
    if (l < prel && r < prer) return 0;
    if (l > prel && r > prer) return 0;
    if (l + r == prel + prer) continue;
    if (l > prel || r < prer) {
      if (tie == 0) tie = 1;
      else return 0;
    }
//    cout << l << " " << r << endl;
  }
//  cout << cnt <<
  for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) _cnt += a[i][j] ^ 1;
  if (cnt != _cnt) return 0;
  return cnt;
}

int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
  n = N;
  for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) a[i][j] = F[i][j];
//  return 0;
  return check_valid();

}

#ifdef ngu
int main()
{
  freopen ("task.inp", "r", stdin);
  freopen ("task.out", "w", stdout);
    int N;
    assert(1 == scanf("%d", &N));
    std::vector<std::vector<int>> F(N, std::vector<int>(N));
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            assert(1 == scanf("%d", &F[i][j]));
        }
    }
    fclose(stdin);

    int res = biggest_stadium(N, F);

    printf("%d\n", res);
    fclose(stdout);
    return 0;
}
#endif // ngu

Compilation message

soccer.cpp: In function 'int check_valid()':
soccer.cpp:26:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     if (r - l + 1 != arr[i].size()) return 0;
      |         ~~~~~~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB ok
2 Correct 1 ms 500 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 1 ms 344 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 348 KB partial
7 Partially correct 2 ms 2648 KB partial
8 Partially correct 18 ms 8124 KB partial
9 Partially correct 294 ms 71364 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB ok
2 Correct 1 ms 500 KB ok
3 Partially correct 1 ms 348 KB partial
4 Partially correct 1 ms 512 KB partial
5 Partially correct 1 ms 348 KB partial
6 Partially correct 1 ms 492 KB partial
7 Partially correct 1 ms 348 KB partial
8 Correct 0 ms 348 KB ok
9 Correct 1 ms 348 KB ok
10 Partially correct 0 ms 348 KB partial
11 Partially correct 0 ms 348 KB partial
12 Partially correct 1 ms 348 KB partial
13 Correct 0 ms 348 KB ok
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
2 Correct 1 ms 344 KB ok
3 Correct 1 ms 500 KB ok
4 Partially correct 1 ms 348 KB partial
5 Partially correct 1 ms 512 KB partial
6 Partially correct 1 ms 348 KB partial
7 Partially correct 1 ms 492 KB partial
8 Partially correct 1 ms 348 KB partial
9 Correct 0 ms 348 KB ok
10 Correct 1 ms 348 KB ok
11 Partially correct 0 ms 348 KB partial
12 Partially correct 0 ms 348 KB partial
13 Partially correct 1 ms 348 KB partial
14 Correct 0 ms 348 KB ok
15 Partially correct 1 ms 348 KB partial
16 Partially correct 0 ms 348 KB partial
17 Partially correct 0 ms 348 KB partial
18 Partially correct 1 ms 344 KB partial
19 Partially correct 1 ms 348 KB partial
20 Correct 1 ms 512 KB ok
21 Correct 0 ms 344 KB ok
22 Partially correct 1 ms 604 KB partial
23 Partially correct 1 ms 348 KB partial
24 Incorrect 1 ms 344 KB wrong
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
2 Correct 1 ms 344 KB ok
3 Correct 1 ms 500 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 344 KB ok
6 Partially correct 1 ms 348 KB partial
7 Partially correct 1 ms 512 KB partial
8 Partially correct 1 ms 348 KB partial
9 Partially correct 1 ms 492 KB partial
10 Partially correct 1 ms 348 KB partial
11 Correct 0 ms 348 KB ok
12 Correct 1 ms 348 KB ok
13 Partially correct 0 ms 348 KB partial
14 Partially correct 0 ms 348 KB partial
15 Partially correct 1 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Partially correct 1 ms 348 KB partial
18 Partially correct 0 ms 348 KB partial
19 Partially correct 0 ms 348 KB partial
20 Partially correct 1 ms 344 KB partial
21 Partially correct 1 ms 348 KB partial
22 Correct 1 ms 512 KB ok
23 Correct 0 ms 344 KB ok
24 Partially correct 1 ms 604 KB partial
25 Partially correct 1 ms 348 KB partial
26 Incorrect 1 ms 344 KB wrong
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
2 Correct 1 ms 344 KB ok
3 Correct 1 ms 500 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 344 KB ok
6 Partially correct 1 ms 348 KB partial
7 Partially correct 1 ms 512 KB partial
8 Partially correct 1 ms 348 KB partial
9 Partially correct 1 ms 492 KB partial
10 Partially correct 1 ms 348 KB partial
11 Correct 0 ms 348 KB ok
12 Correct 1 ms 348 KB ok
13 Partially correct 0 ms 348 KB partial
14 Partially correct 0 ms 348 KB partial
15 Partially correct 1 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Partially correct 1 ms 348 KB partial
18 Partially correct 0 ms 348 KB partial
19 Partially correct 0 ms 348 KB partial
20 Partially correct 1 ms 344 KB partial
21 Partially correct 1 ms 348 KB partial
22 Correct 1 ms 512 KB ok
23 Correct 0 ms 344 KB ok
24 Partially correct 1 ms 604 KB partial
25 Partially correct 1 ms 348 KB partial
26 Incorrect 1 ms 344 KB wrong
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
2 Correct 1 ms 344 KB ok
3 Correct 1 ms 500 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 344 KB ok
6 Correct 0 ms 348 KB ok
7 Partially correct 0 ms 348 KB partial
8 Partially correct 2 ms 2648 KB partial
9 Partially correct 18 ms 8124 KB partial
10 Partially correct 294 ms 71364 KB partial
11 Partially correct 1 ms 348 KB partial
12 Partially correct 1 ms 512 KB partial
13 Partially correct 1 ms 348 KB partial
14 Partially correct 1 ms 492 KB partial
15 Partially correct 1 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Correct 1 ms 348 KB ok
18 Partially correct 0 ms 348 KB partial
19 Partially correct 0 ms 348 KB partial
20 Partially correct 1 ms 348 KB partial
21 Correct 0 ms 348 KB ok
22 Partially correct 1 ms 348 KB partial
23 Partially correct 0 ms 348 KB partial
24 Partially correct 0 ms 348 KB partial
25 Partially correct 1 ms 344 KB partial
26 Partially correct 1 ms 348 KB partial
27 Correct 1 ms 512 KB ok
28 Correct 0 ms 344 KB ok
29 Partially correct 1 ms 604 KB partial
30 Partially correct 1 ms 348 KB partial
31 Incorrect 1 ms 344 KB wrong
32 Halted 0 ms 0 KB -