Submission #570181

#TimeUsernameProblemLanguageResultExecution timeMemory
570181XJP12Mountains (NOI20_mountains)C++14
66 / 100
2096 ms2644 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main(){ ll n; cin>>n; vector<ll> v(n); bool ban=true; for(ll i=0; i<n; i++){ cin>>v[i]; if(i>0 && ban==true){ if(v[i]<v[i-1]) ban=false; } } if(ban==true){ cout<<"0"<<endl; return 0; } ll cont=1; ll ans=0; ll a,b; while(cont<n-1){ a=0; b=0; for(ll i=0; i<cont; i++){ if(v[i]<v[cont]) a++; } for(ll i=cont+1; i<n; i++){ if(v[i]<v[cont]) b++; } ans+=a*b; cont++; } cout<<ans<<endl; 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...