# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
56347 | soham1234 | Baloni (COCI15_baloni) | C++14 | 151 ms | 15212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define FOR(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define int long long int
using namespace std;
const int MOD=1e9+7;
const int INF=4000000000000000000ll;
int mul(int a,int b)
{
if(a>INF/b) return INF;
else return a*b;
}
#undef int
int main()
{
#define int long long int
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//freopen("input.txt","r",stdin);
int n;
cin>>n;
int h[n];
FOR(i,n) cin>>h[i];
int found[1000002];
fill(found,found+1000002,0);
int ans=0;
FOR(i,n)
{
if(found[h[i]]==0)
{
ans++;
}
else
{
found[h[i]]-=1;
}
found[h[i]-1]+=1;
}
cout<<ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |