Submission #392847

# Submission time Handle Problem Language Result Execution time Memory
392847 2021-04-21T22:05:01 Z rainboy Baloni (COCI15_baloni) C
100 / 100
98 ms 272 KB
#include <stdio.h>

#define A	1000000

int main() {
	static int kk[A + 2];
	int n, ans;

	scanf("%d", &n);
	ans = n;
	while (n--) {
		int a;

		scanf("%d", &a);
		if (kk[a + 1] > 0)
			kk[a + 1]--, ans--;
		kk[a]++;
	}
	printf("%d\n", ans);
	return 0;
}

Compilation message

baloni.c: In function 'main':
baloni.c:9:2: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
    9 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
baloni.c:14:3: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   14 |   scanf("%d", &a);
      |   ^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 91 ms 204 KB Output is correct
6 Correct 98 ms 204 KB Output is correct
7 Correct 80 ms 204 KB Output is correct
8 Correct 81 ms 272 KB Output is correct
9 Correct 85 ms 204 KB Output is correct
10 Correct 86 ms 204 KB Output is correct