답안 #1084800

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1084800 2024-09-07T03:16:41 Z thangdz2k7 축구 경기장 (IOI23_soccer) C++17
0 / 100
1 ms 348 KB
// 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]);
            }
        }
    }

    return res;
}

Compilation message

soccer.cpp:20:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   20 | void maxl(auto &a, auto b) {a = max(a, b);}
      |           ^~~~
soccer.cpp:20:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   20 | void maxl(auto &a, auto b) {a = max(a, b);}
      |                    ^~~~
soccer.cpp:21:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   21 | void minl(auto &a, auto b) {a = min(a, b);}
      |           ^~~~
soccer.cpp:21:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   21 | void minl(auto &a, auto b) {a = min(a, b);}
      |                    ^~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -