Submission #570170

#TimeUsernameProblemLanguageResultExecution timeMemory
570170kamilamartinezMountains (NOI20_mountains)C++14
66 / 100
2065 ms2636 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, i, cont=0, a, b, j; cin >> n; ll xd[n]; bool lol=false; for(i=0;i<n;i++) { cin >> xd[i]; if(xd[i-1]>xd[i]) lol=true; } if(lol==false) { cout << "0" << endl; return 0; } for(i=1;i<n-1;i++) { a=0; b=0; for(j=0;j<i;j++) { if(xd[j]<xd[i]) a++; } for(j=i+1;j<n;j++) { if(xd[j]<xd[i]) b++; } cont+=a*b; } cout << cont << 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...