QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#550283#7120. Soccerthangthang0 0ms0kbC++201.7kb2024-09-07 11:18:042024-09-07 11:18:04

Judging History

你现在查看的是最新测评结果

  • [2024-09-07 11:18:04]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-09-07 11:18:04]
  • 提交

answer

// author : thembululquaUwU
// 3.9.2024

#include <bits/stdc++.h>
#define left __left__
#define right __right__
#define pb push_back
#define fi first
#define se second
#define endl '\n'

using namespace std;
using ll = long long;
using ii = pair <int, int>;
using vi = vector <int>;

const int MaxN = 2e5;
const int mod = 1e9 + 7;

void maxl(auto &a, auto b) {a = max(a, b);}
void minl(auto &a, auto b) {a = min(a, b);}

int biggest_stadium(int n, vector <vi> f){
    vector <int> dp(n), h(n);
    vector <vi> cur(n); int res = 0;
    for (int r = 0; r < n; ++ r){
        for (int c = 0; c < n; ++ c){
            if (f[r][c]){
                h[c] = -1;
                dp[c] = 0;
            }
            else cur[++ h[c]].pb(c);
        }

        vi left(n), right(n);
        stack <int> stk;
        for (int c = 0; c < n; ++ c){
            while (stk.size() && h[c] <= h[stk.top()]) stk.pop();
            left[c] = stk.empty() ? -1 : stk.top();
            stk.push(c);
        }
        while (stk.size()) stk.pop();
        for (int c = n - 1; c >= 0; -- c){
            while (stk.size() && h[c] <= h[stk.top()]) stk.pop();
            right[c] = stk.empty() ? n : stk.top();
            stk.push(c);
        }

        for (int hh = 0; hh < n; ++ hh){
            for (int c : cur[hh]){
                int len = right[c] - left[c] - 1;
                dp[c] += len;
                if (left[c] > -1) maxl(dp[c], dp[left[c]] + len * (h[c] - h[left[c]]));
                if (right[c] < n) maxl(dp[c], dp[right[c]] + len * (h[c] - h[right[c]]));
                maxl(res, dp[c]);
            }
            cur[hh].clear();
        }
    }

    return res;
}

详细

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
1
0

output:


result:


Subtask #2:

score: 0
Runtime Error

Test #10:

score: 0
Runtime Error

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 1 0
0 1 1

output:


result:


Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%