Submission #93988

#TimeUsernameProblemLanguageResultExecution timeMemory
93988RakhmandBaloni (COCI15_baloni)C++14
100 / 100
71 ms4088 KiB
#include <cstring> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <queue> #include <cmath> #include <cstdlib> #include <ctime> #include <cassert> #define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0); #define S second #define F first #define pb push_back #define nl '\n' #define NL cout << '\n'; #define EX exit(0) #define all(s) s.begin(), s.end() #define FOR(i, start, finish, k) for(int i = start; i <= finish; i += k) const long long MXN = 1e6 + 1; const long long MNN = 1e5 + 1; const long long MOD = 998244353; const long long INF = 1e18; const long long OO = 1e9 + 500; typedef long long llong; typedef unsigned long long ullong; using namespace std; int n, x, ans, cnt[MXN]; int main(){ ios; cin >> n; for(int i = 1; i <= n; i++){ cin >> x; if(cnt[x] == 0){ ans++; cnt[x - 1]++; }else{ cnt[x]--; cnt[x - 1]++; } }cout << ans; return 0; } /* 8 2 12 1 2 4 2 1 3 5 6 2 3 6 4 5 2 1 5 4 3 */
#Verdict Execution timeMemoryGrader output
Fetching results...