Submission #439003

#TimeUsernameProblemLanguageResultExecution timeMemory
439003skybergMountains (NOI20_mountains)C++17
64 / 100
2076 ms2600 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; long long int c[300000]; int main(){ int n; cin >> n; long long int ans = 0; for(int i = 0; i < n; i++){ cin >> c[i]; } for(int i = 1; i < n - 1; i++){ long long int a = 0, b = 0; for(int j = 0; j < i; j++){ if(c[j] < c[i])a++; } for(int j = i + 1; j < n; j++){ if(c[j] < c[i])b++; } ans += a * b; } cout << ans; 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...