Skip to content

Commit 53af839

Browse files
committed
Added solution of problem BALONI from COCI
1 parent c71a948 commit 53af839

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

COCI/COCI-2015-216-Round#1/BALONI.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
int main() {
5+
int n;
6+
cin >> n;
7+
8+
int ans = 0;
9+
map<int, int> mapa;
10+
for (int i = 0; i < n; ++i) {
11+
int a;
12+
cin >> a;
13+
14+
if (mapa[a + 1] == 0) ans ++;
15+
else mapa[a + 1] --;
16+
mapa[a] ++;
17+
}
18+
19+
cout << ans << endl;
20+
return 0;
21+
}

0 commit comments

Comments
 (0)