# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
329139 | 2020-11-19T12:52:09 Z | oak | Mountains (NOI20_mountains) | C++14 | 2000 ms | 3108 KB |
#include<bits/stdc++.h> using namespace std; int main(){ int n,j,i; scanf("%d",&n); int arr[n],sum[n]; multiset<int> ms; for(i=0;i<n;i++){ scanf("%d",&arr[i]); ms.insert(arr[i]); sum[i] = distance(ms.begin(),ms.lower_bound(arr[i])); //printf("%d ",sum[i]); } //printf("\n"); long long ans = 0; ms.clear(); for(i=n-1;i>=0;i--){ ms.insert(arr[i]); sum[i] *= distance(ms.begin(),ms.lower_bound(arr[i])); ans += sum[i]; //printf("%d ",sum[i]); } //printf("\n"); printf("%lld",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Execution timed out | 2074 ms | 2540 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2092 ms | 3108 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2092 ms | 3108 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2092 ms | 3108 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Execution timed out | 2074 ms | 2540 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |