Submission #875323

# Submission time Handle Problem Language Result Execution time Memory
875323 2023-11-19T06:29:14 Z serifefedartar Vudu (COCI15_vudu) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fast ios::sync_with_stdio(0);cin.tie(0);
#define s second
#define f first
typedef long long ll;
const ll MOD = 998244353;
const ll LOGN = 20; 
const ll MAXN = 5e5 + 100;
#define int long long

vector<int> A;
tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> s;
int pref[MAXN];

signed main() {
	fast
	int N, P;
	cin >> N;

	A = vector<int>(N+1);
	for (int i = 1; i <= N; i++)
		cin >> A[i];
	for (int i = 1; i <= N; i++)
		pref[i] = pref[i-1] + A[i];
	cin >> P;

	int ans = 0;
	for (int i = 1; i <= N; i++) {
		ans += s.order_of_key(P * i - pref[i] + P);
		s.insert(P * i - pref[i-1]);
	}
	cout << ans << "\n";
}

Compilation message

vudu.cpp: In function 'int main()':
vudu.cpp:33:41: error: cannot convert 'long long int' to '__gnu_pbds::tree_order_statistics_node_update<__gnu_pbds::detail::bin_search_tree_const_node_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<long long int, long long int>, long unsigned int, std::allocator<char> >, __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<long long int, long long int>, long unsigned int, std::allocator<char> >*, std::pair<long long int, long long int>, std::pair<long long int, long long int>*, const std::pair<long long int, long long int>*, std::pair<long long int, long long int>&, const std::pair<long long int, long long int>&, true, std::allocator<char> >, __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<long long int, long long int>, long unsigned int, std::allocator<char> >*, std::pair<long long int, long long int>, std::pair<long long int, long long int>*, const std::pair<long long int, long long int>*, std::pair<long long int, long long int>&, const std::pair<long long int, long long int>&, true, std::allocator<char> >, std::allocator<char> >, __gnu_pbds::detail::bin_search_tree_const_node_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<long long int, long long int>, long unsigned int, std::allocator<char> >, __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<long long int, long long int>, long unsigned int, std::allocator<char> >*, std::pair<long long int, long long int>, std::pair<long long int, long long int>*, const std::pair<long long int, long long int>*, std::pair<long long int, long long int>&, const std::pair<long long int, long long int>&, true, std::allocator<char> >, __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<long long int, long long int>, long unsigned int, std::allocator<char> >*, std::pair<long long int, long long int>, std::pair<long long int, long long int>*, const std::pair<long long int, long long int>*, std::pair<long long int, long long int>&, const std::pair<long long int, long long int>&, true, std::allocator<char> >, std::allocator<char> >, std::less<std::pair<long long int, long long int> >, std::allocator<char> >::key_const_reference' {aka 'const std::pair<long long int, long long int>&'}
   33 |   ans += s.order_of_key(P * i - pref[i] + P);
      |                         ~~~~~~~~~~~~~~~~^~~
      |                                         |
      |                                         long long int
In file included from /usr/include/c++/10/ext/pb_ds/tree_policy.hpp:149,
                 from /usr/include/c++/10/ext/pb_ds/detail/standard_policies.hpp:48,
                 from /usr/include/c++/10/ext/pb_ds/assoc_container.hpp:47,
                 from vudu.cpp:2:
/usr/include/c++/10/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp:79:34: note:   initializing argument 1 of '__gnu_pbds::tree_order_statistics_node_update<Node_CItr, Node_Itr, Cmp_Fn, _Alloc>::size_type __gnu_pbds::tree_order_statistics_node_update<Node_CItr, Node_Itr, Cmp_Fn, _Alloc>::order_of_key(__gnu_pbds::tree_order_statistics_node_update<Node_CItr, Node_Itr, Cmp_Fn, _Alloc>::key_const_reference) const [with Node_CItr = __gnu_pbds::detail::bin_search_tree_const_node_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<long long int, long long int>, long unsigned int, std::allocator<char> >, __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<long long int, long long int>, long unsigned int, std::allocator<char> >*, std::pair<long long int, long long int>, std::pair<long long int, long long int>*, const std::pair<long long int, long long int>*, std::pair<long long int, long long int>&, const std::pair<long long int, long long int>&, true, std::allocator<char> >, __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<long long int, long long int>, long unsigned int, std::allocator<char> >*, std::pair<long long int, long long int>, std::pair<long long int, long long int>*, const std::pair<long long int, long long int>*, std::pair<long long int, long long int>&, const std::pair<long long int, long long int>&, true, std::allocator<char> >, std::allocator<char> >; Node_Itr = __gnu_pbds::detail::bin_search_tree_const_node_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<long long int, long long int>, long unsigned int, std::allocator<char> >, __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<long long int, long long int>, long unsigned int, std::allocator<char> >*, std::pair<long long int, long long int>, std::pair<long long int, long long int>*, const std::pair<long long int, long long int>*, std::pair<long long int, long long int>&, const std::pair<long long int, long long int>&, true, std::allocator<char> >, __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<long long int, long long int>, long unsigned int, std::allocator<char> >*, std::pair<long long int, long long int>, std::pair<long long int, long long int>*, const std::pair<long long int, long long int>*, std::pair<long long int, long long int>&, const std::pair<long long int, long long int>&, true, std::allocator<char> >, std::allocator<char> >; Cmp_Fn = std::less<std::pair<long long int, long long int> >; _Alloc = std::allocator<char>; __gnu_pbds::tree_order_statistics_node_update<Node_CItr, Node_Itr, Cmp_Fn, _Alloc>::size_type = long unsigned int; __gnu_pbds::tree_order_statistics_node_update<Node_CItr, Node_Itr, Cmp_Fn, _Alloc>::key_const_reference = const std::pair<long long int, long long int>&]'
   79 | order_of_key(key_const_reference r_key) const
      |              ~~~~~~~~~~~~~~~~~~~~^~~~~
vudu.cpp:34:18: error: cannot convert 'long long int' to '__gnu_pbds::detail::rb_tree_set<std::pair<long long int, long long int>, __gnu_pbds::null_type, std::less<std::pair<long long int, long long int> >, __gnu_pbds::detail::tree_traits<std::pair<long long int, long long int>, __gnu_pbds::null_type, std::less<std::pair<long long int, long long int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >, std::allocator<char> >::const_reference' {aka 'const std::pair<long long int, long long int>&'}
   34 |   s.insert(P * i - pref[i-1]);
      |            ~~~~~~^~~~~~~~~~~
      |                  |
      |                  long long int
In file included from /usr/include/c++/10/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp:235,
                 from /usr/include/c++/10/ext/pb_ds/detail/container_base_dispatch.hpp:85,
                 from /usr/include/c++/10/ext/pb_ds/assoc_container.hpp:48,
                 from vudu.cpp:2:
/usr/include/c++/10/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp:46:24: note:   initializing argument 1 of 'std::pair<typename __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_iterator, bool> __gnu_pbds::detail::rb_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::insert(__gnu_pbds::detail::rb_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::const_reference) [with Key = std::pair<long long int, long long int>; Mapped = __gnu_pbds::null_type; Cmp_Fn = std::less<std::pair<long long int, long long int> >; Node_And_It_Traits = __gnu_pbds::detail::tree_traits<std::pair<long long int, long long int>, __gnu_pbds::null_type, std::less<std::pair<long long int, long long int> >, __gnu_pbds::tree_order_statistics_node_update, __gnu_pbds::rb_tree_tag, std::allocator<char> >; _Alloc = std::allocator<char>; typename __gnu_pbds::detail::bin_search_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::point_iterator = __gnu_pbds::detail::bin_search_tree_const_it_<__gnu_pbds::detail::rb_tree_node_<std::pair<long long int, long long int>, long unsigned int, std::allocator<char> >*, std::pair<long long int, long long int>, std::pair<long long int, long long int>*, const std::pair<long long int, long long int>*, std::pair<long long int, long long int>&, const std::pair<long long int, long long int>&, true, std::allocator<char> >; __gnu_pbds::detail::rb_tree_set<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>::const_reference = const std::pair<long long int, long long int>&]'
   46 | insert(const_reference r_value)
      |        ~~~~~~~~~~~~~~~~^~~~~~~