# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1112518 | vjudge1 | Baloni (COCI15_baloni) | C++17 | 2082 ms | 7500 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>
#define int long long
using namespace std;
int32_t main(){
int n;
cin>>n;
vector<int> v(n);
int ans=1;
map<int,int> mp;
mp[1]=v[0];
for(int i=0; i<n; i++){
bool hit=false;
cin>>v[i];
if(i==0) mp[1]=v[i];
else{
for(int x=1; x<=ans; x++){
if(mp[x]==v[i]+1){
mp[x]--;
hit=true;
break;
}
}
if(!hit){
ans++;
mp[ans]=v[i];
}
}
}
cout<<ans<<"\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |