Submission #585866

#TimeUsernameProblemLanguageResultExecution timeMemory
585866sofijavelkovskaMountains (NOI20_mountains)C++14
64 / 100
2085 ms8104 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, l, r, i, j; long long s=0; cin >> n; long long a[n]; for (i=0; i<n; i++) cin >> a[i]; for (i=0; i<n; i++) { l=0; r=0; for (j=0; j<i; j++) if (a[j]<a[i]) l=l+1; for (j=i+1; j<n; j++) if (a[j]<a[i]) r=r+1; s=s+(l*r); } cout << s; 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...