Submission #345864

# Submission time Handle Problem Language Result Execution time Memory
345864 2021-01-08T10:44:00 Z oleh1421 "The Lyuboyn" code (IZhO19_lyuboyn) C++17
3 / 100
266 ms 7892 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;
    }
    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){
      |         ~~~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB The output is neither -1 nor the length of the answer
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Expected integer, but "0000" found
# Verdict Execution time Memory 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 1 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
# Verdict Execution time Memory Grader output
1 Incorrect 258 ms 7864 KB Expected integer, but "000000000000000000" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Expected integer, but "0000000" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 266 ms 7892 KB Expected integer, but "010101010011010100" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 258 ms 7864 KB Expected integer, but "000000000000000000" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 129 ms 4148 KB Expected integer, but "01011001010101101" found
2 Halted 0 ms 0 KB -