답안 #840679

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
840679 2023-08-31T15:41:12 Z hcng 축구 경기장 (IOI23_soccer) C++17
1.5 / 100
245 ms 31764 KB
#include <bits/stdc++.h>
#include "soccer.h"

using namespace std;

int biggest_stadium(int n, vector<vector<int>> f) {
    int cnt = 0;
    vector<pair<int, int>> v;
    bool flag = false;
    for (int i = 0; i < n; i++) {
        int l = -1, r = -1;
        for (int j = 0; j < n; j++) {
            if (f[i][j] == 0) cnt++;
            if (f[i][j] == 0 && l == -1) {
                l = j;
            }
            if (f[i][j] == 0 && r != -1) {
                return -1;
            }
            if (f[i][j] == 1 && l != -1) {
                r = j - 1;
            }
        }
        if (l != -1 && r == -1) r = n - 1;
        if (!v.empty() && l == -1) {
            flag = true;
        }
        if (flag && l != -1) {
            return -1;
        }
        if (l != -1) v.emplace_back(l, r);
    }
    flag = false;
    for (int i = 1; i < v.size(); i++) {
        if ((v[i].first > v[i - 1].first && v[i].second > v[i - 1].second) || (v[i].first < v[i - 1].first && v[i].second < v[i - 1].second)) {
            return -1;
        }
        if (!flag) {
            if (!(v[i].first <= v[i - 1].first && v[i].second >= v[i - 1].first)) {
                flag = true;
            }
        } else {
            if (!(v[i].first >= v[i - 1].first && v[i].second <= v[i - 1].first)) {
                return -1;
            }
        }
    }
    return cnt;
}

Compilation message

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:34:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for (int i = 1; i < v.size(); i++) {
      |                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 336 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB ok
2 Correct 0 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 2 ms 340 KB partial
8 Partially correct 15 ms 2260 KB partial
9 Partially correct 245 ms 31764 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB ok
2 Correct 0 ms 212 KB ok
3 Partially correct 1 ms 212 KB partial
4 Incorrect 0 ms 212 KB wrong
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 336 KB partial
2 Correct 0 ms 212 KB ok
3 Correct 0 ms 212 KB ok
4 Partially correct 1 ms 212 KB partial
5 Incorrect 0 ms 212 KB wrong
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 336 KB partial
2 Correct 0 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 1 ms 212 KB partial
7 Incorrect 0 ms 212 KB wrong
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 336 KB partial
2 Correct 0 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 1 ms 212 KB partial
7 Incorrect 0 ms 212 KB wrong
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 336 KB partial
2 Correct 0 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 Correct 0 ms 212 KB ok
7 Partially correct 0 ms 212 KB partial
8 Partially correct 2 ms 340 KB partial
9 Partially correct 15 ms 2260 KB partial
10 Partially correct 245 ms 31764 KB partial
11 Partially correct 1 ms 212 KB partial
12 Incorrect 0 ms 212 KB wrong
13 Halted 0 ms 0 KB -