Submission #1084803

#TimeUsernameProblemLanguageResultExecution timeMemory
1084803thangdz2k7Soccer Stadium (IOI23_soccer)C++17
100 / 100
354 ms55888 KiB
// 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, -1); 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; }

Compilation message (stderr)

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);}
      |                    ^~~~
#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...