Submission #557118

# Submission time Handle Problem Language Result Execution time Memory
557118 2022-05-04T18:28:21 Z donaldchuity Mountains (NOI20_mountains) C++17
0 / 100
2000 ms 1364 KB
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n; cin >> n;
  int h[n]; 
  bool status = false;
  for (int i = 0; i < n; i++) {
  	cin >> h[i];
  	if (i >= 1) if (h[i] < h[i-1]) status = true;
  }
  if (status == false) cout << "0\n";
  else {
  	int count = 0;
	  for (int i = 0; i < n; i++) {
	  	for (int j = i+1; j < n; j++) {
	  		for (int k = j+1; k < n; k++) {
	  			if (h[i] < h[j] and h[j] > h[k]) count++;
			  }
		  }
	  }
	  cout << count << "\n";
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 2091 ms 1364 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2091 ms 1364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2091 ms 1364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2091 ms 1364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 2091 ms 1364 KB Time limit exceeded
3 Halted 0 ms 0 KB -