# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
745317 | rainboy | Exam (eJOI20_exam) | C11 | 6 ms | 6420 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#define N 100000
#define N_ 5000
int max(int a, int b) { return a > b ? a : b; }
int main() {
static int aa[N], bb[N], dp[N_ + 1], ww[N_ + 1][N_ + 1];
int n, i, j, l, r, k, k_;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &aa[i]);
for (i = 0; i < n; i++)
scanf("%d", &bb[i]);
if (n <= N_) {
for (i = 0; i < n; i++) {
k = 0;
for (l = i; l >= 0 && (l == i || aa[l] < aa[i]); l--) {
k_ = k += (bb[l] == aa[i] ? 1 : 0);
for (r = i; r < n && aa[r] <= aa[i]; r++) {
if (r > i)
k_ += (bb[r] == aa[i] ? 1 : 0);
ww[l][r + 1] = k_;
}
}
}
dp[0] = 0;
for (i = 0; i <= n; i++)
for (j = i + 1; j <= n; j++)
dp[j] = max(dp[j], dp[i] + ww[i][j]);
printf("%d\n", dp[n]);
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |