Submission #319661

#TimeUsernameProblemLanguageResultExecution timeMemory
319661ignaciocantaBaloni (COCI15_baloni)C++14
100 / 100
218 ms8036 KiB
#include <bits/stdc++.h> using namespace std; #define forsn(i, s, n) for(int i=s;i<int(n);i++) #define forn(i, n) forsn(i, 0, n) #define all(v) v.begin(), v.end() #define NACHO ios_base::sync_with_stdio(0);cin.tie(NULL); typedef long long tint; int main(){ int n; cin >> n; vector<int> a (n); forn(i, n) cin >> a[i]; vector<int> visited (1000002, 0); vector<bool> tiene (n, 0); forn(i, n){ visited[a[i]]++; if(visited[a[i]+1]){ tiene[i] = 1; visited[a[i]+1]--;} } int cont = 0; forn(i, n){ if(tiene[i] == 0) cont++; } cout << cont << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...