# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
740039 | 2023-05-12T02:21:02 Z | mzv | Baloni (COCI15_baloni) | C++17 | 0 ms | 0 KB |
#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; }