답안 #283744

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
283744 2020-08-26T06:45:37 Z 최은수(#5746) Žarulje (COI15_zarulje) C++17
22 / 100
52 ms 29056 KB
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
const int mod=1e9+7;
inline int add(int x,int y)
{
    return x+y<mod?x+y:x+y-mod;
}
inline int mul(int x,int y)
{
    return(int)((ll)x*y%mod);
}
int dp[2010][2010];
int a[200010];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k;
    cin>>n>>k;
    for(int i=0;i++<n;)
        cin>>a[i];
    dp[1][n]=1;
    for(int i=n-1;i-->0;)
    {
        for(int j=1;i+j<=n;j++)
        {
            int k=i+j;
            if(a[k+1]>a[j-1])
                dp[j][k]=dp[j][k+1];
            else if(a[j-1]>a[k+1])
                dp[j][k]=dp[j-1][k];
            else
                dp[j][k]=add(dp[j-1][k],dp[j][k+1]);
        }
    }
    for(int qi=0;qi<k;qi++)
    {
        int x;
        cin>>x;
        cout<<dp[x][x]<<'\n';
    }
    cout.flush();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 768 KB Output is correct
2 Correct 8 ms 6272 KB Output is correct
3 Correct 25 ms 14200 KB Output is correct
4 Correct 29 ms 14200 KB Output is correct
5 Correct 24 ms 14208 KB Output is correct
6 Correct 24 ms 14208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 52 ms 29056 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 768 KB Output is correct
2 Correct 8 ms 6272 KB Output is correct
3 Correct 25 ms 14200 KB Output is correct
4 Correct 29 ms 14200 KB Output is correct
5 Correct 24 ms 14208 KB Output is correct
6 Correct 24 ms 14208 KB Output is correct
7 Runtime error 52 ms 29056 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -