Submission #285475

#TimeUsernameProblemLanguageResultExecution timeMemory
285475achibasadzishviliMountains (NOI20_mountains)C++14
0 / 100
1119 ms19900 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<int, null_type,less<int>, 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...