Submission #357892

#TimeUsernameProblemLanguageResultExecution timeMemory
357892beepbeepsheepBaloni (COCI15_baloni)C++17
100 / 100
71 ms11884 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const ll bignum=1e17; const int inf= 2e9; const int mod= 1e9+7; ll arr[1000001]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); memset(arr,0,sizeof(arr)); ll n,ele,ans=0; cin>>n; for (int i=0;i<n;i++){ cin>>ele; if (arr[ele]==0){ ans++; arr[ele-1]++; } else{ arr[ele]--; arr[ele-1]++; } } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...