답안 #505124

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
505124 2022-01-10T15:50:38 Z leaked "The Lyuboyn" code (IZhO19_lyuboyn) C++14
3 / 100
55 ms 6368 KB
//#include <bits/stdc++.h>
#include <bits/stdc++.h>
#define f first
#define s second
#define vec vector
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pw(x) (1LL<<(x))
#define sz(x) (int)(x).size()
#define fast_izho ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define m_p make_pair
using namespace std;
template <class T> bool umin(T &a,const T &b){return (a>b?a=b,1:0);}
template <class T> bool umax(T &a,const T &b){return (a<b?a=b,1:0);}
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
auto rng=bind(uniform_int_distribution<int>(1,1e7),mt19937(time(0)));

signed main(){
    fast_izho;
//    ifstream cin("input.txt");
    int n,k,t;
    cin>>n>>k>>t;
    n=pw(n);
    vec<int> base,elim;
    for(int i=0;i<n;i++){
        if(__builtin_popcount(i)==k){
            int x=i;
            for(auto &z : elim) x=min(x,x^z);
            if(x){
                base.pb(i);
                elim.pb(x);
            }
        }
    }
    if(sz(base)!=(__builtin_popcount(n-1))){
        cout<<-1;
        return 0;
    }
    int xr=0;
    vec<int>ans;
    ans.pb(0);
    for(int i=1;i<n;i++){
//        cout<<xr<<' ';
        xr^=base[31-__builtin_clz(i&-i)];
        ans.pb(xr);

//        cout<<xr<<'\n';
    }
//    int s;
    string s;
    cin>>s;
    int x=stoi(s);
//    cin>>s;
    for(auto &z : ans)
        z^=x;
    for(int i=0;i<n;i++){
        int j=(i+1)%n;
        if(i==n-1 && t==0) continue;
        if(__builtin_popcount(ans[i]^ans[j])!=k){
            cout<<-1;
            return 0;
        }
    }
    int need=__builtin_popcount(n-1);
    cout<<n<<'\n';
    for(auto &z : ans){
        string me;
        for(int j=0;j<need;j++){
            me+=(pw(j)&z?'0':'1');
        }
//        reverse(all(me));
        cout<<me<<'\n';
    }
    return 0;
}
/*
5 1
0 1 1 3 2
1 3
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 320 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB First number in answer is not x 0 15
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Ok
2 Correct 1 ms 296 KB Ok
3 Correct 1 ms 204 KB Ok
4 Correct 0 ms 204 KB Ok
5 Correct 0 ms 204 KB Ok
6 Correct 1 ms 208 KB Ok
7 Correct 0 ms 204 KB Ok
8 Correct 2 ms 204 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Incorrect 55 ms 6368 KB First number in answer is not x 0 262143
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB First number in answer is not x 0 127
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 2760 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 55 ms 6368 KB First number in answer is not x 0 262143
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 1740 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -