#include <bits/stdc++.h>
using namespace std;
int main(){
long long n;
long long cont1=0;
long long cont2=0;
long long ans2 = 0;
cin>>n;
long long v[n];
for(int i=0; i<n; i++){
cin>>v[i];
}
for(int i=1; i<n; i++){
for(int j=0; j<i; j++){
if(v[i] > v[j]){
cont1 += 1; }
}
for(int k=n-1; k>i; k--){
if(v[i] > v[k]){
cont2 +=1; }
}
ans2 += (cont1*cont2);
cont1 =0;
cont2=0;
}
//cout<<"program compiled, output: "<<ans2;
cout<<ans2;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
2084 ms |
2516 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2079 ms |
2516 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2079 ms |
2516 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
210 ms |
340 KB |
Output is correct |
12 |
Correct |
197 ms |
352 KB |
Output is correct |
13 |
Correct |
195 ms |
352 KB |
Output is correct |
14 |
Correct |
220 ms |
352 KB |
Output is correct |
15 |
Correct |
189 ms |
352 KB |
Output is correct |
16 |
Correct |
194 ms |
352 KB |
Output is correct |
17 |
Correct |
229 ms |
348 KB |
Output is correct |
18 |
Correct |
198 ms |
352 KB |
Output is correct |
19 |
Correct |
191 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2079 ms |
2516 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
2084 ms |
2516 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |