Submission #1158423

#TimeUsernameProblemLanguageResultExecution timeMemory
1158423Wendidiaskpopa (BOI18_popa)C++20
Compilation error
0 ms0 KiB
/* :---:--:--::::::--:-:----: ::-:::. ::-::: .* -===.. :--- .-+*##=-------====-: :--: :+##=.* -= :=+- .-=: .+++-. :- -=. .=+- .--. .++=- + -= :*- :-. +*+- :- -=. -*: :=: #*: * -=. +- .= =:%+ -: -=. +- -- -%: * -=. *: +. :%-.. =. -=. # -: :=# .. + -=. == -= ---+ . = -=. .# .+ -: == . = :------::------:.-=. % .= :- == .=. ---:. :--#+. .% :- = .* .+.. :=- :++ -+ =: + #. + -=: :*%-*: * := :# :=:= . :-----: =+-+ .+ * -* *=- . .- :::::::. :* .#+. + :- -+ :#. --::-----: :* ++= .- + :*. *. .:::::*%: ++ +.-=. + + -#**----: .= -*. + -= = * +.#=+: + . .=+: =. -=. = = -+ :++: + .. .=+= .= -=. - = %- :====-:. =. .:--===- * -=. - + +-- .:--==#==-:.= + -=. = * + * =. : .= -=. = + = * + = -=. + :- = .= =: = -=. .- * + =: * * -=. + :- .+ =- :- .+ -=. .+ * * := * := -= * = :- =: .- .=: -=. =: -: * .=- + .=- -= :- =: -: --: :- :--: -=. .= =:+ ----. * :---. -= .+ --=*----------------------=*+=--=+--=+*+------------------------------------------------%+:. :: := +:- -- :. .=. =. -= -= .=: .=. .=: .+: :-- :-: -- -=. :--. --: :--: .--: .-:-: ::--. :----. .:---- .:::::::::-::::::--::::::::. */ // Hello this is Tyx2019's clone #include "popa.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define debug(x) cerr << #x << " is " << x << "\n" #define hehe ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define rep(i, a, b) for (int i = a; i <= b; i++) #define repb(i, a, b) for (int i = b; i >= a; i--) #define pii pair<int, int> #define linebreak cout << "---------------------------------------------------------\n" #define f first #define s second #define pb push_back #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") // good luck const ll MS = 1005, mod = 1e9+9, INF = 3e18, blk = 400; int next[MS], L[MS], R[MS]; int build(int l, int r) { if (l > r) return -1; int m = l; while (next[m] <= r) m = next[m]; L[m] = build(l, m-1); R[m] = build(m+1, r); return m; } int solve(int n, int *left, int *right) { stack<int> st; // next[i] = first index j such that a[j] divides a[i], ..., a[j]. // i.e. first index j such that gcd(a[i, ... ,j]) = a[j] for (int i = 0; i < n; i++) { if (st.empty()) { st.push(i); continue; } while (!st.empty() and query(st.top(), i, i, i)) { next[st.back()] = i; st.pop(); } st.push(i); } while (!st.empty()){ next[st.back()] = MS-1; st.pop(); } int root = build(0, n-1); for (int i = 0; i < n; i++) left[i] = L[i], right[i] = r[i]; return root; }

Compilation message (stderr)

popa.cpp: In function 'int build(int, int)':
popa.cpp:75:16: error: reference to 'next' is ambiguous
   75 |         while (next[m] <= r) m = next[m];
      |                ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 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 popa.cpp:55:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:213:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename std::iterator_traits<_Iter>::difference_type)'
  213 |     next(_InputIterator __x, typename
      |     ^~~~
popa.cpp:71:5: note:                 'int next [1005]'
   71 | int next[MS], L[MS], R[MS];
      |     ^~~~
popa.cpp:75:34: error: reference to 'next' is ambiguous
   75 |         while (next[m] <= r) m = next[m];
      |                                  ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 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 popa.cpp:55:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:213:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename std::iterator_traits<_Iter>::difference_type)'
  213 |     next(_InputIterator __x, typename
      |     ^~~~
popa.cpp:71:5: note:                 'int next [1005]'
   71 | int next[MS], L[MS], R[MS];
      |     ^~~~
popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:88:25: error: reference to 'next' is ambiguous
   88 |                         next[st.back()] = i; st.pop();
      |                         ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 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 popa.cpp:55:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:213:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename std::iterator_traits<_Iter>::difference_type)'
  213 |     next(_InputIterator __x, typename
      |     ^~~~
popa.cpp:71:5: note:                 'int next [1005]'
   71 | int next[MS], L[MS], R[MS];
      |     ^~~~
popa.cpp:88:33: error: 'class std::stack<int>' has no member named 'back'
   88 |                         next[st.back()] = i; st.pop();
      |                                 ^~~~
popa.cpp:93:17: error: reference to 'next' is ambiguous
   93 |                 next[st.back()] = MS-1; st.pop();
      |                 ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:66,
                 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 popa.cpp:55:
/usr/include/c++/11/bits/stl_iterator_base_funcs.h:213:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename std::iterator_traits<_Iter>::difference_type)'
  213 |     next(_InputIterator __x, typename
      |     ^~~~
popa.cpp:71:5: note:                 'int next [1005]'
   71 | int next[MS], L[MS], R[MS];
      |     ^~~~
popa.cpp:93:25: error: 'class std::stack<int>' has no member named 'back'
   93 |                 next[st.back()] = MS-1; st.pop();
      |                         ^~~~
popa.cpp:96:64: error: 'r' was not declared in this scope
   96 |         for (int i = 0; i < n; i++) left[i] = L[i], right[i] = r[i];
      |                                                                ^