Submission #171432

# Submission time Handle Problem Language Result Execution time Memory
171432 2019-12-28T16:24:31 Z donentseto "The Lyuboyn" code (IZhO19_lyuboyn) C++14
3 / 100
253 ms 5496 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;
    }

    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:17:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < ss.size (); i ++){
                     ~~^~~~~~~~~~~~
lyuboyn.cpp:22:36: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
     for (int i = 0; i < 1 << n - k - 1; i ++){
                              ~~~~~~^~~
lyuboyn.cpp:28:36: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
         for (int j = 1; j < 1 << k + 1; j ++){
                                  ~~^~~
lyuboyn.cpp:31:26: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
             s ^= (1 << k + 1) - 1;
                        ~~^~~
lyuboyn.cpp:37:21: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
         y += 1 << k + 1;
                   ~~^~~
lyuboyn.cpp:39:22: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
         s ^= (1 << k - 1) - 1;
                    ~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB The output is neither -1 nor the length of the answer
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Expected integer, but "0000" found
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Ok
2 Correct 2 ms 376 KB Ok
3 Correct 2 ms 376 KB Ok
4 Correct 2 ms 376 KB Ok
5 Correct 2 ms 380 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 Incorrect 234 ms 5496 KB Expected integer, but "000000000000000000" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Expected integer, but "0000000" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 253 ms 5364 KB Expected integer, but "010101010011010100" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 234 ms 5496 KB Expected integer, but "000000000000000000" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 117 ms 2792 KB Expected integer, but "01011001010101101" found
2 Halted 0 ms 0 KB -