# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
93988 | Rakhmand | Baloni (COCI15_baloni) | C++14 | 71 ms | 4088 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |