Submission #171433

#TimeUsernameProblemLanguageResultExecution timeMemory
171433donentseto"The Lyuboyn" code (IZhO19_lyuboyn)C++14
100 / 100
288 ms5528 KiB
#include <bits/stdc++.h>
using namespace std;
int n, k, t, s;
string ss;
int main (){

    ios::sync_with_stdio (false);
    cin.tie (0);

    cin >> n >> k >> t >> ss;

    if (k % 2 == 0){
        cout << "-1\n";
        return 0;
    }
	cout << (1 << n) << '\n';
  
    for (int i = 0; i < ss.size (); i ++){
        s <<= 1;
        s += ss [i] - '0';
    }
    int x = 0, y = 0;
    for (int i = 0; i < 1 << n - k - 1; i ++){
        for (int d = n - 1; d >= 0; d --){
            cout << ((s >> d) & 1);
        }
        cout << '\n';
        x = 0;
        for (int j = 1; j < 1 << k + 1; j ++){
            x ++;
            s ^= x & -x;
            s ^= (1 << k + 1) - 1;
            for (int d = n - 1; d >= 0; d --){
                cout << ((s >> d) & 1);
            }
            cout << '\n';
        }
        y += 1 << k + 1;
        s ^= y & -y;
        s ^= (1 << k - 1) - 1;
    }

}

Compilation message (stderr)

lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:18:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < ss.size (); i ++){
                     ~~^~~~~~~~~~~~
lyuboyn.cpp:23:36: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
     for (int i = 0; i < 1 << n - k - 1; i ++){
                              ~~~~~~^~~
lyuboyn.cpp:29:36: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
         for (int j = 1; j < 1 << k + 1; j ++){
                                  ~~^~~
lyuboyn.cpp:32:26: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
             s ^= (1 << k + 1) - 1;
                        ~~^~~
lyuboyn.cpp:38:21: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
         y += 1 << k + 1;
                   ~~^~~
lyuboyn.cpp:40:22: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
         s ^= (1 << k - 1) - 1;
                    ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...