Submission #484282

# Submission time Handle Problem Language Result Execution time Memory
484282 2021-11-02T20:06:54 Z rainboy Po (COCI21_po) C
20 / 70
13 ms 1740 KB
#include <stdio.h>

#define N	100000

int main() {
	static int aa[N], qu[N];
	int n, i, cnt, ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	ans = n, cnt = 0;
	for (i = 0; i < n; i++) {
		while (cnt && aa[qu[cnt - 1]] > aa[i])
			cnt--;
		if (cnt && aa[qu[cnt - 1]] == aa[i])
			ans--;
		qu[cnt++] = i;
	}
	printf("%d\n", ans);
	return 0;
}

Compilation message

Main.c: In function 'main':
Main.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
Main.c:11:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Incorrect 5 ms 588 KB Output isn't correct
5 Incorrect 7 ms 716 KB Output isn't correct
6 Correct 13 ms 1740 KB Output is correct
7 Incorrect 13 ms 1548 KB Output isn't correct