Submission #541757

#TimeUsernameProblemLanguageResultExecution timeMemory
541757nutzuBaloni (COCI15_baloni)C++11
100 / 100
174 ms7188 KiB
#include <iostream> using namespace std; long long n,i,s=0,x,x1,v[1000001]; long long v1[1000001]; int main() { cin>>n; for(i=1; i<=n; i++) { cin>>v[i]; } for(i=1; i<=n; i++) { if(v1[v[i]]>0) { v1[v[i]]--; v1[v[i]-1]++; } else { s++; v1[v[i]-1]++; } //cout << s << " " << v1[v[i]] << " " << v1[v[i]-1] << "\n"; } cout<<s; }
#Verdict Execution timeMemoryGrader output
Fetching results...