Submission #171433

# Submission time Handle Problem Language Result Execution time Memory
171433 2019-12-28T16:26:42 Z donentseto "The Lyuboyn" code (IZhO19_lyuboyn) C++14
100 / 100
288 ms 5528 KB
#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

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 time Memory Grader output
1 Correct 2 ms 376 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Ok
2 Correct 2 ms 504 KB Ok
3 Correct 2 ms 380 KB Ok
4 Correct 2 ms 376 KB Ok
5 Correct 2 ms 376 KB Ok
6 Correct 2 ms 376 KB Ok
7 Correct 2 ms 376 KB Ok
8 Correct 2 ms 376 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 237 ms 5528 KB Ok
2 Correct 110 ms 2864 KB Ok
3 Correct 3 ms 376 KB Ok
4 Correct 2 ms 376 KB Ok
5 Correct 2 ms 412 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Ok
2 Correct 7 ms 504 KB Ok
3 Correct 111 ms 2692 KB Ok
4 Correct 54 ms 1400 KB Ok
5 Correct 2 ms 380 KB Ok
6 Correct 3 ms 376 KB Ok
7 Correct 29 ms 888 KB Ok
8 Correct 1 ms 420 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 237 ms 5524 KB Ok
2 Correct 245 ms 5368 KB Ok
3 Correct 288 ms 5368 KB Ok
4 Correct 111 ms 2680 KB Ok
5 Correct 110 ms 2936 KB Ok
6 Correct 55 ms 1400 KB Ok
7 Correct 55 ms 1528 KB Ok
8 Correct 26 ms 888 KB Ok
9 Correct 26 ms 888 KB Ok
10 Correct 14 ms 632 KB Ok
11 Correct 3 ms 376 KB Ok
12 Correct 3 ms 376 KB Ok
13 Correct 2 ms 376 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 237 ms 5528 KB Ok
2 Correct 110 ms 2864 KB Ok
3 Correct 3 ms 376 KB Ok
4 Correct 2 ms 376 KB Ok
5 Correct 2 ms 412 KB Ok
6 Correct 2 ms 376 KB Ok
7 Correct 7 ms 504 KB Ok
8 Correct 111 ms 2692 KB Ok
9 Correct 54 ms 1400 KB Ok
10 Correct 2 ms 380 KB Ok
11 Correct 3 ms 376 KB Ok
12 Correct 29 ms 888 KB Ok
13 Correct 1 ms 420 KB Ok
14 Correct 237 ms 5524 KB Ok
15 Correct 245 ms 5368 KB Ok
16 Correct 288 ms 5368 KB Ok
17 Correct 111 ms 2680 KB Ok
18 Correct 110 ms 2936 KB Ok
19 Correct 55 ms 1400 KB Ok
20 Correct 55 ms 1528 KB Ok
21 Correct 26 ms 888 KB Ok
22 Correct 26 ms 888 KB Ok
23 Correct 14 ms 632 KB Ok
24 Correct 3 ms 376 KB Ok
25 Correct 3 ms 376 KB Ok
26 Correct 2 ms 376 KB Ok
27 Correct 237 ms 5364 KB Ok
28 Correct 111 ms 2680 KB Ok
29 Correct 232 ms 5368 KB Ok
30 Correct 13 ms 504 KB Ok
31 Correct 3 ms 376 KB Ok
32 Correct 7 ms 376 KB Ok
33 Correct 27 ms 1016 KB Ok
34 Correct 2 ms 376 KB Ok
35 Correct 2 ms 376 KB Ok
36 Correct 2 ms 376 KB Ok
37 Correct 2 ms 376 KB Ok
38 Correct 115 ms 2680 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 111 ms 2640 KB Ok
2 Correct 235 ms 5364 KB Ok
3 Correct 231 ms 5364 KB Ok
4 Correct 13 ms 632 KB Ok
5 Correct 2 ms 376 KB Ok
6 Correct 27 ms 888 KB Ok
7 Correct 233 ms 5320 KB Ok
8 Correct 3 ms 376 KB Ok
9 Correct 2 ms 376 KB Ok
10 Correct 2 ms 376 KB Ok
11 Correct 56 ms 1400 KB Ok
12 Correct 111 ms 2696 KB Ok