Submission #960231

# Submission time Handle Problem Language Result Execution time Memory
960231 2024-04-10T00:22:29 Z ezzzay Baloni (COCI15_baloni) C++14
100 / 100
261 ms 13136 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
const int N=2e6+5;
int a[N];
bool vis[N];
signed main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int p=0;
	map<int,int>mp;
	for(int i=1;i<=n;i++){
		if(mp[a[i]+1]==0){
			p++;
			mp[a[i]]++;
		}
		else{
			mp[a[i]+1]--;
			mp[a[i]]++;
		}
	}
	cout<<p;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 2 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 261 ms 10680 KB Output is correct
6 Correct 261 ms 13136 KB Output is correct
7 Correct 203 ms 10068 KB Output is correct
8 Correct 202 ms 10064 KB Output is correct
9 Correct 244 ms 10416 KB Output is correct
10 Correct 231 ms 10424 KB Output is correct