Submission #486161

# Submission time Handle Problem Language Result Execution time Memory
486161 2021-11-10T16:18:39 Z groupATSU Baloni (COCI15_baloni) C++14
100 / 100
306 ms 3968 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll inf=1e9;
const int maxn=1e6+10;
const ll mod=1e9+7;
void solve(){
	int a;
	cin>>a;
	map <int,int> used;
	int ans=0;
	for(int i=0;i<a;i++){
		int x;
		cin>>x;
		if(used[x]==0){
			ans++;
			used[x-1]++;
		}else{
			used[x]--;
			used[x-1]++;
		}
	}
	cout<<ans;
}
int main(){
	//ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    int t=1;
   	//cin>>t;
    while(t--){
        solve();
        cout<<'\n';
    }


}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 2 ms 300 KB Output is correct
5 Correct 294 ms 3968 KB Output is correct
6 Correct 306 ms 3892 KB Output is correct
7 Correct 242 ms 3116 KB Output is correct
8 Correct 225 ms 3112 KB Output is correct
9 Correct 272 ms 3528 KB Output is correct
10 Correct 255 ms 3384 KB Output is correct