제출 #171432

#제출 시각아이디문제언어결과실행 시간메모리
171432donentseto"The Lyuboyn" code (IZhO19_lyuboyn)C++14
3 / 100
253 ms5496 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;
    }

    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;
    }

}

컴파일 시 표준 에러 (stderr) 메시지

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 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...