Submission #740040

#TimeUsernameProblemLanguageResultExecution timeMemory
740040mzvBaloni (COCI15_baloni)C++17
100 / 100
71 ms4512 KiB
#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(arrow,0,sizeof(arrow)); 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...