# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
156129 |
2019-10-03T15:03:54 Z |
Moses |
Baloni (COCI15_baloni) |
C++14 |
|
409 ms |
7544 KB |
// Created by AboAbdoMC
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
const int OO = 1e9+7;
const int MOD = 1e9+7;
const int N = 1e6+7;
int h[N];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
rep(i,n) cin >> h[i];
multiset<int> st;
rep(i,n)
{
if (st.find(h[i]) == st.end())
{
st.insert(h[i]-1);
}
else
{
st.erase(st.find(h[i]));
st.insert(h[i]-1);
}
}
cout << st.size() << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
376 KB |
Output is correct |
4 |
Correct |
4 ms |
504 KB |
Output is correct |
5 |
Correct |
334 ms |
7164 KB |
Output is correct |
6 |
Correct |
409 ms |
7544 KB |
Output is correct |
7 |
Correct |
335 ms |
6264 KB |
Output is correct |
8 |
Correct |
332 ms |
6272 KB |
Output is correct |
9 |
Correct |
338 ms |
6704 KB |
Output is correct |
10 |
Correct |
364 ms |
6776 KB |
Output is correct |