# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1112420 | vjudge1 | Baloni (COCI15_baloni) | C++17 | 2078 ms | 11540 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int mileh(int n, vector<int>& h) {
int a = 0;
while (!h.empty()) {
int m = h[0];
a++;
vector<int> nh;
bool p = false;
for (int i = 0; i < h.size(); i++) {
if (h[i] == m && !p) {
p = true;
continue;
}
if (p && h[i] < m) {
m = h[i];
} else if (h[i] >= m) {
nh.push_back(h[i]);
}
}
h = nh;
}
return a;
}
int main() {
int n;
cin >> n;
vector<int> h(n);
for (int i = 0; i < n; i++) {
cin >> h[i];
}
cout << mileh(n, h) << endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |