# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
732322 | vjudge1 | Baloni (COCI15_baloni) | C++17 | 325 ms | 3796 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 sts stable_sort
#define B begin()
#define rB rbegin()
#define E end()
#define rE rend()
#define F first
#define S second
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define eb emplace_back
#define ll long long
#define ui unsigned int
#define ull unsigned long long
using namespace std;
const int MAXN = 1e4 + 4;
const int MOD = 1e9 + 7;
const ll INF = 9223372036854775807LL;
const ll inf = 2147483647;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n; cin >> n;
vector<int> v(n);
for(int i = 0; i < n; i++){
cin >> v[i];
}
vector<int> ans;
for(int i = 0; i < n; i++){
bool a = 0;
for(int j = 0; j < ans.size(); j++){
if(v[i] < ans[j] && ans[j] >= 1){
ans[j]--;
a = 1;
break;
}
}
if(!a){
ans.pb(v[i]);
}
}
cout << ans.size() << "\n";
return 0;
}
/**
**/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |