Submission #337470

# Submission time Handle Problem Language Result Execution time Memory
337470 2020-12-21T01:44:43 Z zapan4 Mountains (NOI20_mountains) C++17
64 / 100
2000 ms 2796 KB
#include <iostream>
#include <cmath> 
#include <stdio.h>
#include <array>
#include <vector>
#include <list>
#include <algorithm>
#include <utility>
#include <string>
#include <sstream>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#define pp pair<int,int>
#define pll pair<ll, ll>
#define ll long long
using namespace std;

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	ll n;
	cin >> n;
	ll mountains[n];
	for (int i = 0; i < n; i++) {
		cin >> mountains[i];
	}
	ll answer = 0;
	for (int i = 1; i < n-1; i++) {
		ll counter = 0;
		for (int j = 0; j < i; j++) {
			if (mountains[j] < mountains[i]) {
				counter++;
			}
		}
		ll counter1 = 0;
		for (int k = i+1; k < n; k++) {
			if (mountains[k] < mountains[i]) {
				counter1++;
			}
		}
		answer += (counter1)*counter;
	}
	cout << answer << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Execution timed out 2075 ms 2796 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2052 ms 2668 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2052 ms 2668 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 97 ms 364 KB Output is correct
12 Correct 98 ms 620 KB Output is correct
13 Correct 97 ms 620 KB Output is correct
14 Correct 97 ms 620 KB Output is correct
15 Correct 98 ms 748 KB Output is correct
16 Correct 98 ms 748 KB Output is correct
17 Correct 99 ms 748 KB Output is correct
18 Correct 98 ms 620 KB Output is correct
19 Correct 93 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2052 ms 2668 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Execution timed out 2075 ms 2796 KB Time limit exceeded
3 Halted 0 ms 0 KB -