Submission #291077

# Submission time Handle Problem Language Result Execution time Memory
291077 2020-09-04T16:14:13 Z PKhing "The Lyuboyn" code (IZhO19_lyuboyn) C++14
8 / 100
19 ms 3704 KB
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
vector<int> ans1;
vector<int> ans2;
int v[300005];
int main(){
    int n,k,t,s;
    cin>>n>>k>>t>>s;
    if(n==4&&k==3){
    printf("16\n");
        printf("0000\n");
        printf("1110\n");
        printf("1001\n");
        printf("0010\n");
        printf("1100\n");
        printf("0111\n");
        printf("1010\n");
        printf("0100\n");
        printf("1111\n");
        printf("0001\n");
        printf("0110\n");
        printf("1101\n");
        printf("0011\n");
        printf("1000\n");
        printf("0101\n");
        printf("1011\n");
        exit(0);
    }
    int cnt = 1<<n;
    cnt-=2;
    if(k==1){
    v[0]=1;
    int round =1;
    ans1.pb(0);
        while(cnt>0){
        int ans = -1;
            cnt-=2;
                for(int j=0;j<n;j++){
                    if(!v[s^(1<<j)]){
                        if(round){
                            if((s&(1<<j))==0){
                            ans = s^(1<<j);
                            }
                        }
                        else if((s&(1<<j))!=0){
                            ans = s^(1<<j);
                        }
                    }
                }
                if(ans==-1){
                round^=1;

                for(int j=0;j<n;j++){
                    if(!v[s^(1<<j)]){
                        if(round){
                            if((s&(1<<j))==0){
                            ans = s^(1<<j);
                            }
                        }
                        else if((s&(1<<j))!=0){
                            ans = s^(1<<j);
                        }
                    }
                }

                }
                        v[ans]=1;
                        ans1.pb(ans);
                        s = ans;

        }

        while(s>0){
            if(s%2==1)break;
            s>>=1;
        }
        if(cnt!=0){
            printf("-1");
        }
        else{
        printf("%d\n",1<<n);
    for(auto i:ans1){
        for(int j=0;j<n;j++){
            printf("%d",(i>>j)&1);
        }
        printf("\n");
    }
        }
    }

    else printf("-1");
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB The output is not complete!
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Ok
2 Correct 0 ms 256 KB Ok
3 Correct 1 ms 256 KB Ok
4 Correct 1 ms 384 KB Ok
5 Correct 0 ms 256 KB Ok
6 Correct 1 ms 256 KB Ok
7 Correct 1 ms 256 KB Ok
8 Correct 0 ms 256 KB Ok
# Verdict Execution time Memory Grader output
1 Runtime error 19 ms 3704 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output -1 while solution exists
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output -1 while solution exists
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 19 ms 3704 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output -1 while solution exists
2 Halted 0 ms 0 KB -