Submission #789447

# Submission time Handle Problem Language Result Execution time Memory
789447 2023-07-21T11:59:04 Z Acanikolic Baloni (COCI15_baloni) C++14
100 / 100
221 ms 7324 KB
#include <bits/stdc++.h>
 
#define ll long long 

#define int long long 
 
#define pb push_back 

#define F first
 
#define S second
 
using namespace std;
 
const long long N = 2e5+10;
 
const long long mod = 1e9+7;
 
const long long inf = 1e18;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
	int n,res = 0;
	cin >> n;
	vector<int>a(n);
	for(int i=0;i<n;i++) cin >> a[i];
	map<int,int>mp;
	for(int i=0;i<n;i++) {
		if(!mp[a[i]]) res++;
		if(mp[a[i]] > 0) mp[a[i]] -= 1;
		mp[a[i]-1] += 1;
	}
	cout << res;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 221 ms 6784 KB Output is correct
6 Correct 221 ms 7324 KB Output is correct
7 Correct 165 ms 6052 KB Output is correct
8 Correct 169 ms 5976 KB Output is correct
9 Correct 208 ms 6284 KB Output is correct
10 Correct 194 ms 6528 KB Output is correct