Submission #570228

#TimeUsernameProblemLanguageResultExecution timeMemory
570228elpro123Mountains (NOI20_mountains)C++14
64 / 100
2090 ms2516 KiB
#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)

Mountains.cpp: In function 'int main()':
Mountains.cpp:15:6: warning: unused variable 'cont' [-Wunused-variable]
   15 | long cont=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...