답안 #498829

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
498829 2021-12-26T12:20:41 Z nickmet2004 "The Lyuboyn" code (IZhO19_lyuboyn) C++11
23 / 100
359 ms 22768 KB
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n , k , T , M,ok;
string s;
int vis[N];
vector<int> ans,v;
void go(int x){
    if(M==0){ok=1;return;}
    --M;
    vis[x]=1;
    ans.emplace_back(x);
    for(int y : v){
        if(ok)break;
        if(!vis[x^y])go(x^y);
    }return;
}
 main (){
ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n>>k>>T>>s;
    for(int i= 0; i < (1<<n); ++i){
        if(__builtin_popcount(i)==k){
            v.emplace_back(i);
        }
    }
    if(k%2==0){cout<<-1;return 0;}
    int X= 0;
    for(int i = 0; i< s.size(); ++i){
        if(s[i]=='1')X+=(1<<(s.size()-i-1));
    }
   // for(int x : v)cout <<x<<endl;
    M = (1<<n);
    go(X);
    if(ans.size()< (1<<n)){cout<<-1;return 0;}
    cout<<(1<<n)<<endl;
    for(int i = 0; i < ans.size();++i){
        for(int j = n-1; ~j; --j)cout << (ans[i]>>j&1);cout<<endl;
    }

}

Compilation message

lyuboyn.cpp:18:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   18 |  main (){
      |  ^~~~
lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:28:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i = 0; i< s.size(); ++i){
      |                    ~^~~~~~~~~~
lyuboyn.cpp:34:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |     if(ans.size()< (1<<n)){cout<<-1;return 0;}
      |        ~~~~~~~~~~^~~~~~~~
lyuboyn.cpp:36:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(int i = 0; i < ans.size();++i){
      |                    ~~^~~~~~~~~~~~
lyuboyn.cpp:37:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   37 |         for(int j = n-1; ~j; --j)cout << (ans[i]>>j&1);cout<<endl;
      |         ^~~
lyuboyn.cpp:37:56: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   37 |         for(int j = n-1; ~j; --j)cout << (ans[i]>>j&1);cout<<endl;
      |                                                        ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Ok
2 Correct 1 ms 204 KB Ok
3 Correct 1 ms 460 KB Ok
4 Correct 0 ms 204 KB Ok
5 Correct 1 ms 204 KB Ok
6 Correct 0 ms 204 KB Ok
7 Correct 0 ms 332 KB Ok
8 Correct 1 ms 332 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Runtime error 14 ms 15768 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Ok
2 Correct 18 ms 856 KB Ok
3 Correct 359 ms 9904 KB Ok
4 Correct 195 ms 5080 KB Ok
5 Correct 1 ms 332 KB Ok
6 Correct 4 ms 432 KB Ok
7 Correct 81 ms 2672 KB Ok
8 Correct 1 ms 204 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Runtime error 20 ms 22768 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 14 ms 15768 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 310 ms 10096 KB Ok
2 Runtime error 2 ms 460 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -