# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
93988 |
2019-01-14T05:11:40 Z |
Rakhmand |
Baloni (COCI15_baloni) |
C++14 |
|
71 ms |
4088 KB |
#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 |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
460 KB |
Output is correct |
5 |
Correct |
66 ms |
4088 KB |
Output is correct |
6 |
Correct |
71 ms |
3832 KB |
Output is correct |
7 |
Correct |
50 ms |
3192 KB |
Output is correct |
8 |
Correct |
49 ms |
3192 KB |
Output is correct |
9 |
Correct |
63 ms |
3704 KB |
Output is correct |
10 |
Correct |
61 ms |
3448 KB |
Output is correct |