Skip to content

Commit

Permalink
Added solution of problem BALONI from COCI
Browse files Browse the repository at this point in the history
  • Loading branch information
jhonber committed Oct 21, 2015
1 parent c71a948 commit 53af839
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions COCI/COCI-2015-216-Round#1/BALONI.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include<bits/stdc++.h>
using namespace std;

int main() {
int n;
cin >> n;

int ans = 0;
map<int, int> mapa;
for (int i = 0; i < n; ++i) {
int a;
cin >> a;

if (mapa[a + 1] == 0) ans ++;
else mapa[a + 1] --;
mapa[a] ++;
}

cout << ans << endl;
return 0;
}

0 comments on commit 53af839

Please sign in to comment.