Submission #839785

# Submission time Handle Problem Language Result Execution time Memory
839785 2023-08-30T15:51:22 Z model_code Soccer Stadium (IOI23_soccer) C++17
1.5 / 100
267 ms 33956 KB
// incorrect/solution_checkregular_wa.cpp

#include "soccer.h"

#define xx first
#define yy second

bool is_unimodal(std::vector<std::pair<int, int>> &ivs)
{
    bool res = true;

    int state = 0;
    for (int i = 1; i < (int)ivs.size();)
    {
        int prev_len = ivs[i - 1].yy - ivs[i - 1].xx,
            curr_len = ivs[i].yy - ivs[i].xx;

        if (state == 0)
        {
            if (prev_len <= curr_len)
            {
                i++;
            }
            else
            {
                state = 1;
            }
        }
        else
        {
            if (prev_len >= curr_len)
            {
                i++;
            }
            else
            {
                res = false;
                break;
            }
        }
    }

    return res;
}

bool is_subintervaled(std::vector<std::pair<int, int>> &ivs)
{
    bool res = true;
    for (const std::pair<int, int> &p : ivs)
    {
        for (const std::pair<int, int> &q : ivs)
        {
            res &= (p.xx <= q.xx && q.yy <= p.yy) || (q.xx <= p.xx && p.yy <= q.yy);
        }
    }

    return res;
}

int biggest_stadium(int N, std::vector<std::vector<int>> C)
{
    int cnt = 0, lens = 0;
    std::vector<std::pair<int, int>> ivs;
    for (int i = 0; i < N; ++i)
    {
        int mn = 1e9, mx = -1e9;
        for (int j = 0; j < N; ++j)
        {
            cnt += C[i][j] == 0;
            if (C[i][j] == 0)
            {
                mn = std::min(mn, j);
                mx = std::max(mx, j);
            }
        }

        if (mn <= mx)
        {
            ivs.push_back({mn, mx});
            lens += mx - mn + 1;
        }
    }

    if (lens != cnt)
        return 1e9; // has holes
    return is_unimodal(ivs) && is_subintervaled(ivs) ? cnt : (int)1e9;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB partial
# Verdict Execution time Memory 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 1 ms 212 KB ok
5 Correct 1 ms 212 KB ok
6 Partially correct 0 ms 212 KB partial
7 Partially correct 1 ms 340 KB partial
8 Partially correct 26 ms 2508 KB partial
9 Partially correct 267 ms 33956 KB partial
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB ok
2 Correct 1 ms 212 KB ok
3 Partially correct 1 ms 212 KB partial
4 Partially correct 1 ms 260 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 Correct 1 ms 212 KB ok
9 Correct 0 ms 212 KB ok
10 Partially correct 0 ms 212 KB partial
11 Incorrect 0 ms 256 KB wrong
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB partial
2 Correct 1 ms 212 KB ok
3 Correct 1 ms 212 KB ok
4 Partially correct 1 ms 212 KB partial
5 Partially correct 1 ms 260 KB partial
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 Correct 1 ms 212 KB ok
10 Correct 0 ms 212 KB ok
11 Partially correct 0 ms 212 KB partial
12 Incorrect 0 ms 256 KB wrong
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 212 KB ok
6 Partially correct 1 ms 212 KB partial
7 Partially correct 1 ms 260 KB partial
8 Partially correct 0 ms 212 KB partial
9 Partially correct 0 ms 212 KB partial
10 Partially correct 0 ms 212 KB partial
11 Correct 1 ms 212 KB ok
12 Correct 0 ms 212 KB ok
13 Partially correct 0 ms 212 KB partial
14 Incorrect 0 ms 256 KB wrong
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 212 KB ok
6 Partially correct 1 ms 212 KB partial
7 Partially correct 1 ms 260 KB partial
8 Partially correct 0 ms 212 KB partial
9 Partially correct 0 ms 212 KB partial
10 Partially correct 0 ms 212 KB partial
11 Correct 1 ms 212 KB ok
12 Correct 0 ms 212 KB ok
13 Partially correct 0 ms 212 KB partial
14 Incorrect 0 ms 256 KB wrong
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 212 KB ok
6 Correct 1 ms 212 KB ok
7 Partially correct 0 ms 212 KB partial
8 Partially correct 1 ms 340 KB partial
9 Partially correct 26 ms 2508 KB partial
10 Partially correct 267 ms 33956 KB partial
11 Partially correct 1 ms 212 KB partial
12 Partially correct 1 ms 260 KB partial
13 Partially correct 0 ms 212 KB partial
14 Partially correct 0 ms 212 KB partial
15 Partially correct 0 ms 212 KB partial
16 Correct 1 ms 212 KB ok
17 Correct 0 ms 212 KB ok
18 Partially correct 0 ms 212 KB partial
19 Incorrect 0 ms 256 KB wrong
20 Halted 0 ms 0 KB -