Submission #240833

#TimeUsernameProblemLanguageResultExecution timeMemory
240833bananamathsBaloni (COCI15_baloni)C++17
0 / 100
7 ms1408 KiB
#include<bits/stdc++.h> using namespace std; int main() { ifstream in("input.txt"); ofstream out("output.txt"); int N; in>>N; int V[N]; for(int i = 0 ;i<N;i++) { in>>V[i]; } bool H[1000002]; int conta = 0; for(int i = 1;i<=1000001;i++) { H[i] = false; } for(int i = 0;i<N;i++) { int a = V[i]; if(H[a+1]) { H[a+1] = false; H[a] = true; } else { conta++; H[a] = true; } } out<<conta; }
#Verdict Execution timeMemoryGrader output
Fetching results...