Submission #240837

#TimeUsernameProblemLanguageResultExecution timeMemory
240837bananamathsBaloni (COCI15_baloni)C++14
100 / 100
290 ms7800 KiB
#include<bits/stdc++.h> using namespace std; int main() { int N; cin>>N; int V[N]; for(int i = 0 ;i<N;i++) { cin>>V[i]; } int H[1000002]; int conta = 0; for(int i = 1;i<=1000001;i++) { H[i] = 0; } for(int i = 0;i<N;i++) { int a = V[i]; if(H[a+1]>0) { H[a+1] -= 1; H[a] +=1; } else { conta++; H[a]++; } } cout<<conta; }
#Verdict Execution timeMemoryGrader output
Fetching results...