# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1112506 | vjudge1 | Baloni (COCI15_baloni) | C++17 | 2079 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() {
long long int s = 0, a;
cin >> a;
vector<int> d(a);
for (long long int i = 0; i < a; i++) {
cin >> d[i];
}
while (true) {
long long int maxi = -1, max = INT_MIN;
for (long long int i = 0; i < d.size(); i++) {
if (d[i] > max) {
max = d[i];
maxi = i;
}
}
if (maxi == -1) {
break;
}
long long int ua = -1;
for (long long 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... |