답안 #519130

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
519130 2022-01-25T17:47:42 Z leaked Vođe (COCI17_vode) C++14
72 / 120
3000 ms 23952 KB
#include <bits/stdc++.h>

#define f first
#define s second
#define m_p make_pair
#define vec vector
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)(x).size()
#define fast_izho ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pw(x) (1<<(x))
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
template <class T> bool umax(T &a,const T &b){return (a<b?a=b,1:0);}
template <class T> bool umin(T &a,const T &b){return (a>b?a=b,1:0);}
const int N=5001;
bool dp[N][N];
signed main(){
    fast_izho;
    int n,m,k;
    cin>>n>>m>>k;
    vec<int>a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
//        for(int j=m;j>m-k;j--)
//            dp[i][j]=1;
    }
    for(int j=m-1;j>=0;j--){
        for(int i=0;i<n;i++){
            int nx=(i+1)%n;
            for(int x=j;x<=min(m,j+k-1);x++){
                if(dp[nx][x+1]==(a[i]==a[nx]))
                    dp[i][j]=1;
            }
//            cout<<"WIN "<<i<<' '<<j<<' '<<dp[i][j]<<endl;
        }
    }
    for(int i=0;i<n;i++){
        cout<<(a[i]^dp[i][1]^1)<<' ';
    }
    return 0;
}
/*

*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 588 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 972 KB Output is correct
2 Correct 2 ms 708 KB Output is correct
3 Correct 8 ms 1096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1228 KB Output is correct
2 Correct 9 ms 1220 KB Output is correct
3 Correct 2 ms 1192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1612 KB Output is correct
2 Correct 14 ms 1868 KB Output is correct
3 Correct 4 ms 1868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 2252 KB Output is correct
2 Correct 10 ms 2240 KB Output is correct
3 Correct 24 ms 2124 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1996 KB Output is correct
2 Correct 13 ms 2124 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 134 ms 8948 KB Output is correct
2 Correct 601 ms 9004 KB Output is correct
3 Execution timed out 3084 ms 23564 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 870 ms 12372 KB Output is correct
2 Execution timed out 3091 ms 23548 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3061 ms 23696 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3044 ms 23952 KB Time limit exceeded
2 Halted 0 ms 0 KB -