Submission #979940

# Submission time Handle Problem Language Result Execution time Memory
979940 2024-05-11T16:56:01 Z vjudge1 Soccer Stadium (IOI23_soccer) C++17
0 / 100
4500 ms 2644 KB
#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector <int>;
using vvi = vector <vi>;
using vll = vector <ll>;

int biggest_stadium (int n, vvi f) {
    ll ans = 0;
    for (ll i = 0; i < n; i++) for (ll j = 0; j < n; j++) {
        if (f[i][j]) continue;
        ll l = j, r = j;
        while (l > 0 && !f[i][l-1]) l--;
        while (r < n-1 && !f[i][r+1]) r++;
        ll li = l, ri = r;
        ll pans = 0;
        for (ll ii = i; ii >= 0; ii--) {
            if (f[ii][j]) break;
            for (ll jj = li; jj <= j; jj++) {
                if (f[ii][jj]) li = jj+1;
            }
            for (ll jj = ri; jj >= j; jj--) {
                if (f[ii][jj]) ri = jj-1;
            }
            assert(li <= ri);
            pans += ri-li+1;
        }
        li = l, ri = r;
        for (ll ii = i+1; ii < n; ii++) {
            if (f[ii][j]) break;
            for (ll jj = li; jj <= j; jj++) {
                if (f[ii][jj]) li = jj+1;
            }
            for (ll jj = ri; jj >= j; jj--) {
                if (f[ii][jj]) ri = jj-1;
            }
            assert(li <= ri);
            pans += ri-li+1;
        }
        ans = max(ans, pans);
    }
    for (ll i = 0; i < n; i++) {
        for (ll j = 0; j < i; j++) {
            swap(f[i][j], f[j][i]);
        }
    }
    for (ll i = 0; i < n; i++) for (ll j = 0; j < n; j++) {
        if (f[i][j]) continue;
        ll l = j, r = j;
        while (l > 0 && !f[i][l-1]) l--;
        while (r < n-1 && !f[i][r+1]) r++;
        ll li = l, ri = r;
        ll pans = 0;
        for (ll ii = i; ii >= 0; ii--) {
            if (f[ii][j]) break;
            for (ll jj = li; jj <= j; jj++) {
                if (f[ii][jj]) li = jj+1;
            }
            for (ll jj = ri; jj >= j; jj--) {
                if (f[ii][jj]) ri = jj-1;
            }
            assert(li <= ri);
            pans += ri-li+1;
        }
        li = l, ri = r;
        for (ll ii = i+1; ii < n; ii++) {
            if (f[ii][j]) break;
            for (ll jj = li; jj <= j; jj++) {
                if (f[ii][jj]) li = jj+1;
            }
            for (ll jj = ri; jj >= j; jj--) {
                if (f[ii][jj]) ri = jj-1;
            }
            assert(li <= ri);
            pans += ri-li+1;
        }
        ans = max(ans, pans);
    }
    return int(ans);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 1 ms 436 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 1 ms 348 KB ok
7 Correct 107 ms 348 KB ok
8 Execution timed out 4539 ms 2644 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 1 ms 436 KB ok
3 Correct 1 ms 344 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Incorrect 1 ms 348 KB wrong
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 344 KB ok
3 Correct 1 ms 436 KB ok
4 Correct 1 ms 344 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Incorrect 1 ms 348 KB wrong
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 344 KB ok
3 Correct 1 ms 436 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 1 ms 344 KB ok
7 Correct 1 ms 348 KB ok
8 Correct 0 ms 348 KB ok
9 Correct 0 ms 348 KB ok
10 Incorrect 1 ms 348 KB wrong
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 344 KB ok
3 Correct 1 ms 436 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 1 ms 344 KB ok
7 Correct 1 ms 348 KB ok
8 Correct 0 ms 348 KB ok
9 Correct 0 ms 348 KB ok
10 Incorrect 1 ms 348 KB wrong
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 344 KB ok
3 Correct 1 ms 436 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 1 ms 348 KB ok
8 Correct 107 ms 348 KB ok
9 Execution timed out 4539 ms 2644 KB Time limit exceeded
10 Halted 0 ms 0 KB -