답안 #83495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
83495 2018-11-08T12:22:06 Z Noam527 Baloni (COCI15_baloni) C++17
100 / 100
113 ms 19884 KB
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define endl '\n'
#define fast ios::sync_with_stdio(0), cin.tie(0)
#define debug cout << "ok" << endl
#define finish(x) return cout << x << endl, 0
typedef long long ll;
typedef long double ldb;
const int md = 1e9 + 7, inf = 1e9 + 7;
const ll hs = 199;
const ldb eps = 1e-9, pi = acos(-1);
using namespace std;

int n, x, a[1000005] = {}, ans = 0;

int main() {
	fast;
	cin >> n;
	while (n--) {
		cin >> x;
		if (a[x]) {
			a[x]--;
			a[x - 1]++;
		}
		else {
			a[x - 1]++;
			ans++;
		}
	}
	finish(ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 456 KB Output is correct
3 Correct 3 ms 632 KB Output is correct
4 Correct 3 ms 632 KB Output is correct
5 Correct 113 ms 4360 KB Output is correct
6 Correct 91 ms 7820 KB Output is correct
7 Correct 77 ms 10664 KB Output is correct
8 Correct 69 ms 13564 KB Output is correct
9 Correct 84 ms 16788 KB Output is correct
10 Correct 79 ms 19884 KB Output is correct