# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
740039 | mzv | Baloni (COCI15_baloni) | C++17 | 0 ms | 0 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 ccd ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
using namespace std;
/* ------------------------ hi lol ------------------------ */
// author : mzv
int n,x,arrow[1'000'000],ans=0;
int main() {
ccd
memset(arr,0,sizeof(arr));
cin >> n;
for (int i=1;i<=n;i++) {
cin >> x;
if (arrow[x]>0) {
arrow[x]--; // ad arrow tinggi x, langsung meledak
}
arrow[x-1]++; // balon ke x kena, arrow jatuh ke x-1
}
for (int i=0;i<=n;i++) {
ans += arrow[i];
}
cout << ans << endl;
}