# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
486368 | 2021-11-11T12:41:51 Z | rainboy | Žarulje (COI15_zarulje) | C | 853 ms | 33588 KB |
#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 - 1] > aa[j + 1]) dp[i][j] = dp[i - 1][j]; else if (aa[i - 1] < aa[j + 1]) 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; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 716 KB | Output is correct |
2 | Correct | 7 ms | 8012 KB | Output is correct |
3 | Correct | 23 ms | 15944 KB | Output is correct |
4 | Correct | 24 ms | 15916 KB | Output is correct |
5 | Correct | 24 ms | 15876 KB | Output is correct |
6 | Correct | 23 ms | 15932 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 853 ms | 33588 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 716 KB | Output is correct |
2 | Correct | 7 ms | 8012 KB | Output is correct |
3 | Correct | 23 ms | 15944 KB | Output is correct |
4 | Correct | 24 ms | 15916 KB | Output is correct |
5 | Correct | 24 ms | 15876 KB | Output is correct |
6 | Correct | 23 ms | 15932 KB | Output is correct |
7 | Runtime error | 853 ms | 33588 KB | Execution killed with signal 11 |
8 | Halted | 0 ms | 0 KB | - |