Submission #56347

#TimeUsernameProblemLanguageResultExecution timeMemory
56347soham1234Baloni (COCI15_baloni)C++14
100 / 100
151 ms15212 KiB
#include<bits/stdc++.h> #define FORE(i,a,b) for(int i=a;i<=b;i++) #define FOR(i,n) for(int i=0;i<n;i++) #define pb push_back #define mp(a,b) make_pair(a,b) #define init(arr,val) memset(arr,val,sizeof(arr)) #define int long long int using namespace std; const int MOD=1e9+7; const int INF=4000000000000000000ll; int mul(int a,int b) { if(a>INF/b) return INF; else return a*b; } #undef int int main() { #define int long long int ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("input.txt","r",stdin); int n; cin>>n; int h[n]; FOR(i,n) cin>>h[i]; int found[1000002]; fill(found,found+1000002,0); int ans=0; FOR(i,n) { if(found[h[i]]==0) { ans++; } else { found[h[i]]-=1; } found[h[i]-1]+=1; } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...