#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;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |