# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1116447 | heey | Baloni (COCI15_baloni) | C++14 | 1523 ms | 12180 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;
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int n; cin >> n;
vector<int> h(n);
for(int i = 0; i < n; i++) cin >> h[i];
vector<stack<int>> ss(1);
for(int i = 0; i < n; i++){
int j = 0;
while(!ss[j].empty() && ss[j].top() != h[i] + 1) j++;
if(ss[j].empty()) {
ss.push_back(stack<int>());
}
ss[j].push(h[i]);
}
cout << ss.size() - 1<< '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |