제출 #486367

#제출 시각아이디문제언어결과실행 시간메모리
486367rainboyŽarulje (COI15_zarulje)C11
0 / 100
793 ms34028 KiB
#include <stdio.h>

#define N	200000
#define SMALL	2000
#define MD	1000000007

int main() {
	static int aa[N], dp[SMALL][SMALL];
	int n, k, i, j;

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

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

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