답안 #345867

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
345867 2021-01-08T10:46:04 Z oleh1421 "The Lyuboyn" code (IZhO19_lyuboyn) C++17
100 / 100
272 ms 8020 KB
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define endl '\n'
const int N=1010;
const ll mod=1000000007;
void print(int x,int n){
    for (int i=n-1;i>=0;i--){
        cout<<(x>>i)%2;
    }
    cout<<endl;
}
void solve(){
    int n,k,t;cin>>n>>k>>t;
    string str;cin>>str;
    int F0=0;
    for (auto i:str){
        F0*=2;
        F0+=i-'0';
    }
    vector<int>basis;
    vector<int>real_basis;
    for (int i=0;i<(1<<n);i++){
        if (__builtin_popcount(i)==k){
            int x=i;
            for (int y:basis){
                x=min(x,x^y);
            }
            if (x) basis.push_back(x),real_basis.push_back(i);
        }
    }
    if (basis.size()!=n){
        cout<<-1<<endl;
        return;
    }
    vector<int>pref;
    for (int i=0;i<n;i++){
        vector<int>nw=pref;
        nw.push_back(real_basis[i]);
        for (int x:pref) nw.push_back(x);
        pref=nw;
    }
    cout<<(1<<n)<<endl;
    print(F0,n);
    for (int x:pref){
        F0^=x;
        print(F0,n);
    }
}
int32_t main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int tt=1;
    while (tt--){
        solve();
    }

    return 0;
}

Compilation message

lyuboyn.cpp: In function 'void solve()':
lyuboyn.cpp:34:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |     if (basis.size()!=n){
      |         ~~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
2 Correct 2 ms 364 KB Ok
3 Correct 2 ms 364 KB Ok
4 Correct 0 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 1 ms 364 KB Ok
7 Correct 1 ms 364 KB Ok
8 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 270 ms 7892 KB Ok
2 Correct 133 ms 4152 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
2 Correct 7 ms 620 KB Ok
3 Correct 128 ms 3952 KB Ok
4 Correct 61 ms 2144 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 2 ms 364 KB Ok
7 Correct 28 ms 1124 KB Ok
8 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 271 ms 7888 KB Ok
2 Correct 264 ms 7980 KB Ok
3 Correct 271 ms 7892 KB Ok
4 Correct 129 ms 4028 KB Ok
5 Correct 124 ms 4036 KB Ok
6 Correct 62 ms 2172 KB Ok
7 Correct 61 ms 2144 KB Ok
8 Correct 28 ms 1124 KB Ok
9 Correct 28 ms 1124 KB Ok
10 Correct 13 ms 808 KB Ok
11 Correct 1 ms 364 KB Ok
12 Correct 1 ms 364 KB Ok
13 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 270 ms 7892 KB Ok
2 Correct 133 ms 4152 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 1 ms 364 KB Ok
7 Correct 7 ms 620 KB Ok
8 Correct 128 ms 3952 KB Ok
9 Correct 61 ms 2144 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 2 ms 364 KB Ok
12 Correct 28 ms 1124 KB Ok
13 Correct 1 ms 364 KB Ok
14 Correct 271 ms 7888 KB Ok
15 Correct 264 ms 7980 KB Ok
16 Correct 271 ms 7892 KB Ok
17 Correct 129 ms 4028 KB Ok
18 Correct 124 ms 4036 KB Ok
19 Correct 62 ms 2172 KB Ok
20 Correct 61 ms 2144 KB Ok
21 Correct 28 ms 1124 KB Ok
22 Correct 28 ms 1124 KB Ok
23 Correct 13 ms 808 KB Ok
24 Correct 1 ms 364 KB Ok
25 Correct 1 ms 364 KB Ok
26 Correct 1 ms 364 KB Ok
27 Correct 272 ms 7960 KB Ok
28 Correct 127 ms 4076 KB Ok
29 Correct 263 ms 8008 KB Ok
30 Correct 13 ms 808 KB Ok
31 Correct 2 ms 364 KB Ok
32 Correct 7 ms 620 KB Ok
33 Correct 29 ms 1124 KB Ok
34 Correct 1 ms 364 KB Ok
35 Correct 1 ms 364 KB Ok
36 Correct 1 ms 364 KB Ok
37 Correct 1 ms 364 KB Ok
38 Correct 127 ms 4060 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 125 ms 3988 KB Ok
2 Correct 260 ms 7892 KB Ok
3 Correct 267 ms 8020 KB Ok
4 Correct 13 ms 808 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 28 ms 1124 KB Ok
7 Correct 260 ms 7892 KB Ok
8 Correct 1 ms 364 KB Ok
9 Correct 1 ms 364 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 59 ms 2144 KB Ok
12 Correct 123 ms 4188 KB Ok