Submission #692294

# Submission time Handle Problem Language Result Execution time Memory
692294 2023-02-01T09:54:38 Z zeroesandones Mountains (IOI17_mountains) C++17
0 / 100
123 ms 280 KB
#include <bits/stdc++.h>
#include "mountains.h"
using namespace std;

using ll = long long;
using vi = vector<ll>;

int maximum_deevs(vector<int> y) {
	int n = y.size();
	int ans = 0;

	for(int i = 0; i < (1<<n); ++i) {
		vi subset;
		for(int j = 0; j < n; ++j) {
			if(i & (1<<j))
				subset.emplace_back(j);
		}

		bool valid = true;
		int m = subset.size();
		sort(subset.begin(), subset.end());
		for(int j = 0; j < m - 1; ++j) {
			bool bigger = false;
			for(int x = subset[j] + 1; x < subset[j + 1]; ++x) {
				if(y[x] > y[subset[j]] && y[x] > y[subset[j + 1]]) {
					bigger = true;
					break;
				}
			}
			if(!bigger) {
				valid = false;
				break;
			}
		}

		if(valid)
			ans = max(ans, m);
	}

	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 123 ms 280 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 123 ms 280 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 123 ms 280 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 123 ms 280 KB Output isn't correct
7 Halted 0 ms 0 KB -