Submission #285478

#TimeUsernameProblemLanguageResultExecution timeMemory
285478achibasadzishviliMountains (NOI20_mountains)C++14
100 / 100
1213 ms24184 KiB
#include <bits/stdc++.h> #define ll long long #define f first #define s second #define pb push_back #define mp make_pair using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<pair<long long,long long>, null_type,less<pair<long long,long long> >, rb_tree_tag,tree_order_statistics_node_update> ll n,ans,a[300005],k[300005]; int main(){ ordered_set st; cin >> n; for(int i=1; i<=n; i++){ cin >> a[i]; k[i] = st.order_of_key(mp(a[i],-1)); st.insert(mp(a[i],i)); } st.clear(); for(int i=n; i>=1; i--){ k[i] *= st.order_of_key(mp(a[i],-1)); st.insert(mp(a[i],i)); ans += k[i]; } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...