Submission #1112419

# Submission time Handle Problem Language Result Execution time Memory
1112419 2024-11-14T07:36:05 Z vjudge1 Baloni (COCI15_baloni) C++17
100 / 100
248 ms 8716 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int MOD = 1000000007;

int32_t main() {
    int n;
    cin >> n;
    
    vector<int> a;
    int x;
    for (int i = 0; i < n; i++) {
        cin >> x;
        a.push_back(x);
    }
	map<int,int> ok;
	
	int sayac=0;
	for(int h : a) {
	
	if(ok[h] >0) {
	
	ok[h]--;
	ok[h-1]++;
	}
	else{
	
	sayac++;
	ok[h-1]++;
	
	}
	}
	cout << sayac <<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 248 ms 8716 KB Output is correct
6 Correct 213 ms 8524 KB Output is correct
7 Correct 168 ms 8576 KB Output is correct
8 Correct 175 ms 8592 KB Output is correct
9 Correct 204 ms 8616 KB Output is correct
10 Correct 195 ms 8644 KB Output is correct