# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
709029 | vjudge1 | Baloni (COCI15_baloni) | C++17 | 2093 ms | 4696 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;
#define ff first
#define sc second
#define pb(x) push_back(x)
#define ll long long
#define sp ' '
#define pairs pair<int, int>
#define mp make_pair
void show(vector <int> v){
for(int i=0; i<v.size(); i++){
cout<<v[i]<<sp;
}
cout<<endl;
}
int main(){
int n,cnt=0;
cin>>n;
vector <int> v;
for(int i=0; i<n; i++){
int h;
cin>>h;
v.pb(h);
}
while(v.size()>0){
int h1=v[0]-1;
for(int j=1; j<v.size(); j++){
if(v[j]==h1){
v.erase(v.begin()+j);
j--;
h1--;
}
}
v.erase(v.begin());
cnt++;
}
cout<<cnt;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |