답안 #236789

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
236789 2020-06-03T10:02:26 Z topovik Vođe (COCI17_vode) C++14
72 / 120
3000 ms 96248 KB
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;

const ll oo = 1e9+7;
const ll N  = 5000+2;

int dp[N][N];
int b[N];
int n,m,k;

int Rec(int x,int y)
{
    if (y==m)        return 0;
    if (dp[x][y]<oo) return dp[x][y];
    int nx=(x+1)%n;
    bool g0=0,g1=0;
    for (int i=1; i<=k && i+y<=m; i++)
    {
        int c=Rec(nx,i+y);
        if (c==0) g0=1;
        if (c==1) g1=1;
    }
    if (b[x]==b[nx]) {
        if (g1==1) dp[x][y]=1;
        else       dp[x][y]=0;
    }
    else    {
        if (g0==1) dp[x][y]=1;
        else       dp[x][y]=0;
    }
    return dp[x][y];
}

int main()
{
    cin>>n>>m>>k;
    for (int i=0; i<n; i++) cin>>b[i];
    m--;
    for (int i=0; i<n; i++)
        for (int j=0; j<=m; j++) dp[i][j]=oo;
    for (int i=0; i<n; i++)
    {
        cout<<(Rec(i,0)^1^b[i])<<" ";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 640 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1408 KB Output is correct
2 Correct 9 ms 768 KB Output is correct
3 Correct 28 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 1536 KB Output is correct
2 Correct 26 ms 1408 KB Output is correct
3 Correct 8 ms 1536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 2048 KB Output is correct
2 Correct 48 ms 2560 KB Output is correct
3 Correct 14 ms 2304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 3072 KB Output is correct
2 Correct 31 ms 2944 KB Output is correct
3 Correct 97 ms 2760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 2816 KB Output is correct
2 Correct 44 ms 2816 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 348 ms 19456 KB Output is correct
2 Correct 2055 ms 20864 KB Output is correct
3 Execution timed out 3102 ms 94968 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Correct 2939 ms 38552 KB Output is correct
2 Execution timed out 3106 ms 94712 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3105 ms 95608 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3084 ms 96248 KB Time limit exceeded
2 Halted 0 ms 0 KB -