답안 #146272

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
146272 2019-08-23T09:12:01 Z Fasho Baloni (COCI15_baloni) C++14
100 / 100
79 ms 3964 KB
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int 	
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("kmp.in","r",stdin);freopen ("kmp.out","w",stdout);
#define mod 1000000009
#define fs(x,y) for(int i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(int i=x;i<=y;i++)
#define INF 1000000000005
using namespace std;

ll n,m,ar[N],sum,tut[N];

int main()
{
	fast;
	cin>>n;
	fo(i,1,n)
	{
		int x;
		cin>>x;
		tut[x]++;
		if(tut[x+1])
			tut[x+1]--;
		else
			sum++;
	}
	cout<<sum;


}



/*     cd onedrive\desktop\kod
cls


*/
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 380 KB Output is correct
4 Correct 3 ms 452 KB Output is correct
5 Correct 79 ms 3964 KB Output is correct
6 Correct 79 ms 3932 KB Output is correct
7 Correct 64 ms 3192 KB Output is correct
8 Correct 64 ms 3192 KB Output is correct
9 Correct 76 ms 3576 KB Output is correct
10 Correct 72 ms 3576 KB Output is correct