Submission #1092792

#TimeUsernameProblemLanguageResultExecution timeMemory
1092792SunbaeMountains (NOI20_mountains)C++17
100 / 100
427 ms29440 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> typedef long long ll; using namespace std; using namespace __gnu_pbds; #define os tree<pair<ll,int>, null_type, less<pair<ll,int>>, rb_tree_tag,tree_order_statistics_node_update> const int N = 3e5 + 5; ll A[N], a[N], tot; signed main(){ int n; scanf("%d", &n); os s; for(int i = 0; i<n; ++i){ scanf("%lld", a+i); A[i] = s.order_of_key(make_pair(a[i], -1)); s.insert(make_pair(a[i], i)); } s.clear(); for(int i = n-1; i>=0; --i){ tot += A[i] *= s.order_of_key(make_pair(a[i], -1)); s.insert(make_pair(a[i], i)); } printf("%lld", tot); }

Compilation message (stderr)

Mountains.cpp: In function 'int main()':
Mountains.cpp:11:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     int n; scanf("%d", &n);
      |            ~~~~~^~~~~~~~~~
Mountains.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%lld", a+i);
      |         ~~~~~^~~~~~~~~~~~~
#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...