https://www.codechef.com/viewsolution/32157851
Why Iam getting compilation Error?
#include
statements.std::less
is a template class, and needs template parameters - if you’re using C++14, you can use less<>
.count
before using it.https://www.codechef.com/viewsolution/32159716
Even after following what you said,I am getting compilation error.
ext/pb_ds/tree_policy.hpp : No such file or directory
#include <ext/pb_ds/tree_policy.hpp >
There’s still spaces in your #include
s.
This one should work
#include <bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define ordered_set tree< int,null_type ,less<int>,rb_tree_tag ,tree_order_statistics_node_update >
int main() {
// your code goes here
// your code goes here
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
int a[n];
int count=0;
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
ordered_set o_set;
for (int i = 0; i < n; i++)
{
o_set.insert(a[i]);
count += (o_set.order_of_key(a[i]));
}
cout << count << "\n";
return 0;
}
I have removed the stray spaces
Thankyou!! It worked
Haa worked