Submission #1130365

#TimeUsernameProblemLanguageResultExecution timeMemory
11303657mody축구 경기장 (IOI23_soccer)C++17
0 / 100
1 ms324 KiB
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int biggest_stadium(int n, vector<vector<int>> arr){
    vector<vector<int>> c(n, vector<int>(n));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(arr[i][j] == 1) c[i][j] = 0;
            else if(i == 0) c[i][j] = 1;
            else c[i][j] = 1 + c[i - 1][j];
        }
    }
    int ans = 0;
    for(int kk = 0; kk < n; kk++){
        vector<int> curr = c[kk];
        stack<int> sl, sr;
        vector<int> l(n), r(n);
        for(int i = 0; i < n; i++){
            while(sl.size() && curr[i] <= curr[sl.top()]){
                sl.pop();
            }
            l[i] = (sl.empty() ? 0 : sl.top() + 1);
            sl.push(i);
        }
        for(int i = n - 1; i >= 0; i--){
            while(sr.size() && curr[i] <= curr[sr.top()]){
                sr.pop();
            }
            r[i] = (sr.empty() ? n - 1 : sr.top() - 1);
            sr.push(i);
        }
        for(int i = 0; i < n; i++){
            ans = max(ans, (r[i] - l[i] + 1) * curr[i]);
        }
    }
    return ans;
}

// void solve()
// {
//     int n; cin >> n;
//     vector<vector<int>> arr(n, vector<int>(n));
//     for (int i = 0; i < n; i++){
//         for (int j = 0; j < n; j++){
//             cin >> arr[i][j];
//         }
//     }
//     cout << biggest_stadium(n, arr) << '\n';
// }

// int main()
// {
//     ios::sync_with_stdio(false);
//     cin.tie(0);
//     int _ = 1;
//     // cin >> _;
//     while(_--){
//         solve();
//     }
// }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...