Submission #1064058

#TimeUsernameProblemLanguageResultExecution timeMemory
1064058DorostWefSoccer Stadium (IOI23_soccer)C++17
Compilation error
0 ms0 KiB
#include "soccer.h" #include <bits/stdc++.h> using namespace std; const int N = 504, INF = -5000000; vector <int> a[N][N]; int dp[N][N][N]; int biggest_stadium(int N, std::vector<std::vector<int>> F) { if (N >= 501) { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (F[i][j]) { int mx = min ({(i + 1) * (j + 1), (i + 1) * (n - j), (n - i) * (j + 1), (n - i) * (n - j)}); return n * n - mx; } } } } int mx = 0; int n = N; for (int l = n - 1; l >= 0; l--) { for (int r = l; r < n; r++) { if (l != r) { a[l][r] = a[l + 1][r]; } for (int j = 0; j < n; j++) { if (F[l][j]) a[l][r].push_back(j); } a[l][r].push_back(-1); a[l][r].push_back(n); sort (a[l][r].begin(), a[l][r].end()); a[l][r].erase (unique (a[l][r].begin(), a[l][r].end()), a[l][r].end()); for (int k = 0; k < (int)a[l][r].size() - 1; k++) { int L = a[l][r][k]; int R = a[l][r][k + 1]; int s = R - L - 1; if (L != -1) { dp[l][r][L] = INF; } for (int w = L + 1; w < R; w++) { int mm = 0; if (l != r) { mm = max (dp[l + 1][r][w], dp[l][r - 1][w]); } dp[l][r][w] = s + mm; //cout << l << ' ' << r << ' ' << L << ' ' << R << endl; mx = max (mx, dp[l][r][w]); } } } } return mx; }

Compilation message (stderr)

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:11:23: error: 'n' was not declared in this scope
   11 |   for (int i = 0; i < n; i++) {
      |                       ^
soccer.cpp:14:96: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   14 |      int mx = min ({(i + 1) * (j + 1), (i + 1) * (n - j), (n - i) * (j + 1), (n - i) * (n - j)});
      |                                                                                                ^
In file included from /usr/include/c++/10/vector:60,
                 from soccer.h:1,
                 from soccer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
soccer.cpp:14:96: note:   candidate expects 2 arguments, 1 provided
   14 |      int mx = min ({(i + 1) * (j + 1), (i + 1) * (n - j), (n - i) * (j + 1), (n - i) * (n - j)});
      |                                                                                                ^
In file included from /usr/include/c++/10/vector:60,
                 from soccer.h:1,
                 from soccer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
soccer.cpp:14:96: note:   candidate expects 3 arguments, 1 provided
   14 |      int mx = min ({(i + 1) * (j + 1), (i + 1) * (n - j), (n - i) * (j + 1), (n - i) * (n - j)});
      |                                                                                                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from soccer.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed: