Submission #345635

# Submission time Handle Problem Language Result Execution time Memory
345635 2021-01-07T17:29:58 Z georgerapeanu "The Lyuboyn" code (IZhO19_lyuboyn) C++11
3 / 100
6 ms 3068 KB
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int n,k,t,s;
vector<int> v;

int main(){
    
    scanf("%d %d %d",&n,&k,&t);
    scanf("%d",&s);///TODO its actually a string

    if(k % 2 == 0){
        printf("-1");
        return 0;
    }

    int _n = 2;
    int _k = 1;
    v = {0,1,3,2};

    while(_k < k){
        vector<int> nv;
        for(int i = 0;i < (1 << _n);i++){
            nv.push_back(v[i] ^ ((i % 2 == 0 ? 0:3) << _n));
        }
        for(int i = 0;i < (1 << _n);i++){
            nv.push_back(((1 << _n) - 1) ^ v[(1 << _n) - 1 - i] ^ ((i % 2 == 0 ? 2:1) << _n));
        }
        for(int i = 0;i < (1 << _n);i++){
            nv.push_back(v[i] ^ ((i % 2 == 0 ? 3:0) << _n));
        }
        for(int i = 0;i < (1 << _n);i++){
            nv.push_back(((1 << _n) - 1) ^ v[(1 << _n) - 1 - i] ^ ((i % 2 == 0 ? 1:2) << _n));
        }

        _k += 2;
        _n += 2;
        v = nv;
    }
    
    while(_n < n){
        vector<int> nv;
        for(int i = 0;i < (1 << _n);i++){
            nv.push_back(v[i]);
        }
        for(int i = 0;i < (1 << _n);i++){
            nv.push_back(v[i] ^ (1 << _n));
        }
        for(int h = 0;h < _n;h++){
            if(((v[0] >> h) & 1) != ((v[(1 << _n) - 1] >> h) & 1)){
                for(int i = (1 << _n);i < (2 << _n);i++){
                    nv[i] ^= (1 << h);
                }
                break;
            }
        }
        _n++;
        v = nv;
    }

/*
    for(int i = 0;i < (1 << n);i++){
        printf("%d ",__builtin_popcount(v[i] ^ v[(i + 1) & ((1 << n) - 1)]));
    }
    printf("\n");
    for(int i = 0;i < (1 << n);i++){
        printf("%d ",v[i]);
    }
    printf("\n");
*/
    return 0;
}

Compilation message

lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |     scanf("%d %d %d",&n,&k,&t);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~
lyuboyn.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |     scanf("%d",&s);///TODO its actually a string
      |     ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Unexpected end of file - int32 expected
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Unexpected end of file - int32 expected
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Ok
2 Correct 0 ms 364 KB Ok
3 Correct 0 ms 364 KB Ok
4 Correct 0 ms 364 KB Ok
5 Correct 0 ms 364 KB Ok
6 Correct 0 ms 364 KB Ok
7 Correct 0 ms 364 KB Ok
8 Correct 0 ms 364 KB Ok
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 3068 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2952 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 3068 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1768 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -