Submission #1086769

#TimeUsernameProblemLanguageResultExecution timeMemory
1086769LOLOLOBaloni (COCI15_baloni)C++17
100 / 100
41 ms4040 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define s second #define f first #define pb push_back #define ep emplace #define eb emplace_back #define lb lower_bound #define ub upper_bound #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define uniquev(v) sort(all(v)), (v).resize(unique(all(v)) - (v).begin()) #define mem(f,x) memset(f , x , sizeof(f)) #define sz(x) (int)(x).size() #define __lcm(a, b) (1ll * ((a) / __gcd((a), (b))) * (b)) #define mxx *max_element #define mnn *min_element #define cntbit(x) __builtin_popcountll(x) #define len(x) (int)(x.length()) const int N = 1e6 + 10; int cnt[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int ans = 0; for (int i = 0; i < n; i++) { int x; cin >> x; if (cnt[x + 1]) { cnt[x + 1]--; } else { ans++; } cnt[x]++; } cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...