제출 #742188

#제출 시각아이디문제언어결과실행 시간메모리
742188rainboySeparator (CEOI19_separator)C11
100 / 100
242 ms25824 KiB
#include <stdio.h>

#define N	1000000
#define MD	1000000000

int main() {
	static int aa[N], qu[N];
	static char ismax[N];
	int n, cnt, i, a_, k;

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

컴파일 시 표준 에러 (stderr) 메시지

separator.c: In function 'main':
separator.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
separator.c:14:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d", &aa[i]), aa[i] = (aa[i] + k) % MD;
      |   ^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...