답안 #40955

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
40955 2018-02-10T12:53:36 Z IvanC Baloni (COCI15_baloni) C++14
100 / 100
131 ms 604 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
int freq[MAXN],N,ans;
int main(){
	scanf("%d",&N);
	for(int i = 1;i<=N;i++){
		int x;
		scanf("%d",&x);
		if(freq[x]){
			freq[x]--;
			freq[x-1]++;
		}
		else{
			ans++;
			freq[x-1]++;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:6:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&N);
                ^
baloni.cpp:9:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
                 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 352 KB Output is correct
3 Correct 2 ms 424 KB Output is correct
4 Correct 2 ms 496 KB Output is correct
5 Correct 98 ms 564 KB Output is correct
6 Correct 131 ms 604 KB Output is correct
7 Correct 84 ms 604 KB Output is correct
8 Correct 83 ms 604 KB Output is correct
9 Correct 93 ms 604 KB Output is correct
10 Correct 97 ms 604 KB Output is correct