# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1112405 | vjudge1 | Baloni (COCI15_baloni) | C++17 | 2069 ms | 3664 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 main() {
int s = 0, a;
cin >> a;
vector<int> d(a);
for (int i = 0; i < a; i++) {
cin >> d[i];
}
while (true) {
int maxi = -1, max = INT_MIN;
for (int i = 0; i < d.size(); i++) {
if (d[i] > max) {
max = d[i];
maxi = i;
}
}
if (maxi == -1) {
break;
}
int ua = -1;
for (int i = maxi; i < d.size() - 1; i++) {
if (d[i] - 1 == d[i + 1]) {
d.erase(d.begin() + i);
ua = i;
i--;
} else {
break;
}
}
if (ua != -1 && ua < d.size()) {
d.erase(d.begin() + ua);
}
s++;
}
cout << s;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |