Submission #285476

#TimeUsernameProblemLanguageResultExecution timeMemory
285476achibasadzishviliMountains (NOI20_mountains)C++14
2 / 100
1010 ms24844 KiB
#include <bits/stdc++.h> #define ll long long #define f first #define s second #define pb push_back 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<long long, null_type,less<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(a[i]); st.insert(a[i]); } st.clear(); for(int i=n; i>=1; i--){ k[i] *= st.order_of_key(a[i]); st.insert(a[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...