Submission #287943

# Submission time Handle Problem Language Result Execution time Memory
287943 2020-09-01T07:07:08 Z tqbfjotld "The Lyuboyn" code (IZhO19_lyuboyn) C++14
14 / 100
256 ms 7040 KB
#include <bits/stdc++.h>
using namespace std;

vector<int> seq;
vector<int> fl;

int main(){
    int n,k,t;
    scanf("%d%d%d",&n,&k,&t);
    if (k%2==0){
        printf("-1");
        return 0;
    }
    for (int x = 1; x<=(1<<n)/2; x++){
        fl.push_back(x&-x);
    }
    int cur = 0;
    for (int x = 0; x<(1<<n); x++){
        seq.push_back(cur);
        //printf("pushed %d\n",cur);
        if (x>=fl.size()){
            cur^=fl[x-fl.size()];
        }
        else cur ^= fl[x];
    }
    int num = 0;
    for (int x = 0; x<n; x++){
        char c;
        num<<=1;
        scanf(" %c",&c);
        num += c-'0';
    }
    int stpos = -1;
    for (int x = 0; x<seq.size(); x++){
        if (seq[x]==num){
            stpos = x;
        }
    }
    assert(stpos!=-1);
    printf("%d\n",1<<n);
    for (int x = 0; x<(1<<n); x++){
        for (int y = n-1; y>=0; y--){
            if (seq[(x+stpos)%seq.size()]&(1<<y)){
                printf("1");
            }
            else printf("0");
        }
        printf("\n");
    }
}

Compilation message

lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:21:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         if (x>=fl.size()){
      |             ~^~~~~~~~~~~
lyuboyn.cpp:34:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for (int x = 0; x<seq.size(); x++){
      |                     ~^~~~~~~~~~~
lyuboyn.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |     scanf("%d%d%d",&n,&k,&t);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
lyuboyn.cpp:30:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   30 |         scanf(" %c",&c);
      |         ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Ok
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Fail, not exactly k bits are different: line = 0
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Ok
2 Correct 1 ms 256 KB Ok
3 Correct 1 ms 256 KB Ok
4 Correct 0 ms 256 KB Ok
5 Correct 1 ms 256 KB Ok
6 Correct 0 ms 256 KB Ok
7 Correct 0 ms 256 KB Ok
8 Correct 1 ms 256 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 256 ms 7016 KB Ok
2 Correct 121 ms 3568 KB Ok
3 Correct 1 ms 384 KB Ok
4 Correct 0 ms 384 KB Ok
5 Correct 1 ms 256 KB Ok
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Fail, not exactly k bits are different: line = 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 255 ms 7040 KB Fail, not exactly k bits are different: line = 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 256 ms 7016 KB Ok
2 Correct 121 ms 3568 KB Ok
3 Correct 1 ms 384 KB Ok
4 Correct 0 ms 384 KB Ok
5 Correct 1 ms 256 KB Ok
6 Incorrect 1 ms 256 KB Fail, not exactly k bits are different: line = 0
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 3696 KB Fail, not exactly k bits are different: line = 0
2 Halted 0 ms 0 KB -