# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
570228 | elpro123 | Mountains (NOI20_mountains) | C++14 | 2090 ms | 2516 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
long n;
cin>>n;
long heigh[n];
for(long i=0; i<n; i++){
cin>>heigh[i];
}
long cont=0;
/*
for(long i=0; i<n-2; i++){
for(long j=i+1; j<n-1; j++){
for(long k=j+1; k<n; k++){
cout<<heigh[i]<<" "<<heigh[j]<<" "<<heigh[k]<<"\n";
if(heigh[i]<heigh[j] and heigh[k]<heigh[j]){
cont++;
}
}
}
}
*/
long aux1=0, aux2=0, total=0;
for(long i=1; i<n-1; i++){
for(long j=i-1; j>=0; j--){
if(heigh[j]<heigh[i]){
aux1++;
}
}
for(long k=i+1; k<n; k++){
if(heigh[k]<heigh[i]){
aux2++;
}
}
total = total + (aux1*aux2);
aux1=0;
aux2=0;
}
cout<<total<<"\n";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |