Submission #506104

# Submission time Handle Problem Language Result Execution time Memory
506104 2022-01-11T15:35:16 Z MurotY Baloni (COCI15_baloni) C++14
100 / 100
330 ms 480 KB
#include<bits/stdc++.h>
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long 
#define ff first
#define ss second
using namespace std;
const int N=1e6+7;
ll a[N];
int main()
{
	ll n , ans=0;
	cin >> n;
	map <ll,ll> mp;
	for (int i=1;i<=n;i++){
		int x;
		cin >> x;
		if (mp[x] == 0) ans++, mp[x-1]++;
		else mp[x]--, mp[x-1]++;
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
5 Correct 330 ms 432 KB Output is correct
6 Correct 322 ms 480 KB Output is correct
7 Correct 238 ms 464 KB Output is correct
8 Correct 255 ms 348 KB Output is correct
9 Correct 265 ms 380 KB Output is correct
10 Correct 260 ms 332 KB Output is correct