답안 #928565

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928565 2024-02-16T16:34:30 Z activedeltorre Exam (eJOI20_exam) C++14
65 / 100
152 ms 98536 KB
#include <iostream>

using namespace std;
int a[5005];
int b[5005];
int st[5005];
int dr[5005];
int dp[5005][5005];
int main()
{
    int n,i,j;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(i=1;i<=n;i++)
    {
        cin>>b[i];
    }
    for(i=1;i<=n;i++)
    {
        st[i]=i;
        while(a[i]>=a[st[i]] && st[i]>=1)
        {
            st[i]--;
        }
        st[i]++;
        dr[i]=i;
        while(a[i]>=a[dr[i]] && dr[i]<=n)
        {
            dr[i]++;
        }
        dr[i]--;
    }
    int sol=0;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=n;j++)
        {
            if(a[i]==b[j] && st[i]<=j && j<=dr[i])
            {
                dp[i][j]=max(dp[i][j],dp[i][j-1]+1);
            }
            else
            {
                dp[i][j]=max(dp[i][j],dp[i][j-1]);
                dp[i][j]=max(dp[i][j],dp[i-1][j]);
            }
            sol=max(sol,dp[i][j]);
        }
    }
    cout<<sol;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 8284 KB Output is correct
2 Runtime error 4 ms 860 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 3 ms 3420 KB Output is correct
3 Correct 29 ms 24156 KB Output is correct
4 Correct 143 ms 94352 KB Output is correct
5 Correct 150 ms 98388 KB Output is correct
6 Correct 152 ms 98396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 143 ms 98536 KB Output is correct
2 Runtime error 4 ms 604 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 1 ms 860 KB Output is correct
10 Correct 1 ms 1372 KB Output is correct
11 Correct 2 ms 1368 KB Output is correct
12 Correct 1 ms 1368 KB Output is correct
13 Correct 1 ms 1368 KB Output is correct
14 Correct 1 ms 1208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 3 ms 3420 KB Output is correct
9 Correct 29 ms 24156 KB Output is correct
10 Correct 143 ms 94352 KB Output is correct
11 Correct 150 ms 98388 KB Output is correct
12 Correct 152 ms 98396 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 1 ms 860 KB Output is correct
16 Correct 1 ms 1372 KB Output is correct
17 Correct 2 ms 1368 KB Output is correct
18 Correct 1 ms 1368 KB Output is correct
19 Correct 1 ms 1368 KB Output is correct
20 Correct 1 ms 1208 KB Output is correct
21 Correct 1 ms 1368 KB Output is correct
22 Correct 8 ms 8280 KB Output is correct
23 Correct 147 ms 98416 KB Output is correct
24 Correct 152 ms 98464 KB Output is correct
25 Correct 142 ms 98384 KB Output is correct
26 Correct 140 ms 98372 KB Output is correct
27 Correct 141 ms 98444 KB Output is correct
28 Correct 140 ms 98384 KB Output is correct
29 Correct 151 ms 98300 KB Output is correct
30 Correct 152 ms 98352 KB Output is correct
31 Correct 151 ms 98352 KB Output is correct
32 Correct 146 ms 98472 KB Output is correct