# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1126093 | 2024-12-12 02:17:43 | caterpillow | Mountains (IOI17_mountains) | C++20 | Compilation error | 0 ms | 0 KiB |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
vector<ll> h;
vector<vector<pair<int, int>>> ranges;
vector<vector<int>> memo;
int dp(int l, int r, int best) {
if (r < l || l < 0) return 0;
if ((r - l) / 2 < best) return 0;
if (memo[l][r] != -1) return memo[l][r];
int res = 1;
for (auto [lo, hi] : ranges[r]) {
if (hi < l) continue;
lo = max(lo, l);
res += dp(lo, hi, -1);
}
return memo[l][r] = max(res, dp(l, r - 1, res));
}
int maximum_deevs(vector<int> y) {
n = y.size();
h.resize(n);
ranges.resize(n);
for (int i = 0; i < n; i++) h[i] = y[i];
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Compilation message (stderr)
mountains.cpp: In function 'int dp(int, int, int)': mountains.cpp:17:26: error: reference to 'ranges' is ambiguous 17 | for (auto [lo, hi] : ranges[r]) { | ^~~~~~ In file included from /usr/include/c++/11/compare:39, from /usr/include/c++/11/bits/stl_pair.h:65, from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from mountains.cpp:1: /usr/include/c++/11/concepts:163:13: note: candidates are: 'namespace std::ranges { }' 163 | namespace ranges | ^~~~~~ mountains.cpp:8:32: note: 'std::vector<std::vector<std::pair<int, int> > > ranges' 8 | vector<vector<pair<int, int>>> ranges; | ^~~~~~ mountains.cpp: In function 'int maximum_deevs(std::vector<int>)': mountains.cpp:29:5: error: reference to 'ranges' is ambiguous 29 | ranges.resize(n); | ^~~~~~ In file included from /usr/include/c++/11/compare:39, from /usr/include/c++/11/bits/stl_pair.h:65, from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from mountains.cpp:1: /usr/include/c++/11/concepts:163:13: note: candidates are: 'namespace std::ranges { }' 163 | namespace ranges | ^~~~~~ mountains.cpp:8:32: note: 'std::vector<std::vector<std::pair<int, int> > > ranges' 8 | vector<vector<pair<int, int>>> ranges; | ^~~~~~ mountains.cpp:39:43: error: reference to 'ranges' is ambiguous 39 | if (i + 1 <= highest - 1) ranges[r].push_back({i + 1, highest - 1}); | ^~~~~~ In file included from /usr/include/c++/11/compare:39, from /usr/include/c++/11/bits/stl_pair.h:65, from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from mountains.cpp:1: /usr/include/c++/11/concepts:163:13: note: candidates are: 'namespace std::ranges { }' 163 | namespace ranges | ^~~~~~ mountains.cpp:8:32: note: 'std::vector<std::vector<std::pair<int, int> > > ranges' 8 | vector<vector<pair<int, int>>> ranges; | ^~~~~~ mountains.cpp:43:22: error: reference to 'ranges' is ambiguous 43 | if (highest) ranges[r].push_back({0, highest - 1}); | ^~~~~~ In file included from /usr/include/c++/11/compare:39, from /usr/include/c++/11/bits/stl_pair.h:65, from /usr/include/c++/11/bits/stl_algobase.h:64, from /usr/include/c++/11/bits/specfun.h:45, from /usr/include/c++/11/cmath:1935, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from mountains.cpp:1: /usr/include/c++/11/concepts:163:13: note: candidates are: 'namespace std::ranges { }' 163 | namespace ranges | ^~~~~~ mountains.cpp:8:32: note: 'std::vector<std::vector<std::pair<int, int> > > ranges' 8 | vector<vector<pair<int, int>>> ranges; | ^~~~~~