Submission #869137

# Submission time Handle Problem Language Result Execution time Memory
869137 2023-11-03T09:51:13 Z alexdd "The Lyuboyn" code (IZhO19_lyuboyn) C++17
19 / 100
1000 ms 10580 KB
#include<bits/stdc++.h>
using namespace std;
bool used[265000];
int n,k,t,s;
bool dif[20];
void afis01(int x)
{
    for(int i=n-1;i>=0;i--)
    {
        if(((1<<i)&x))
            cout<<1;
        else
            cout<<0;
    }
    cout<<"\n";
}
bool rez[265000][20];
void solve_k1()
{
    for(int i=0;i<n-1;i++)
    {
        for(int j=(1<<i);j<(1<<n);j+=(1<<(i+2)))
        {
            for(int p=0;p<(1<<(i+1));p++)
                rez[j+p][i]=1;
        }
    }
    for(int i=(1<<(n-1));i<(1<<n);i++)
        rez[i][n-1]=1;
    cout<<(1<<n)<<"\n";
    for(int i=0;i<(1<<n);i++)
    {
        for(int j=n-1;j>=0;j--)
        {
            cout<<rez[i][j];
        }
        cout<<"\n";
    }
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin>>n>>k>>t>>s;
    if(k%2==0)
    {
        cout<<-1;
        return 0;
    }
    if(k==1)
    {
        solve_k1();
        return 0;
    }
    used[s]=1;
    for(int i=0;i<k;i++)
        dif[i]=1;
    for(int i=k;i<n;i++)
        dif[i]=0;
    cout<<(1<<n)<<"\n";
    afis01(s);
    for(int i=1;i<(1<<n);i++)
    {
        while(1)
        {
            random_shuffle(dif,dif+n);
            int aux=s;
            for(int j=0;j<n;j++)
            {
                if(dif[j])
                    aux = aux ^ (1<<j);
            }
            if(!used[aux])
            {
                s=aux;
                used[s]=1;
                afis01(s);
                break;
            }
        }
    }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB First number in answer is not x 1 0
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Ok
2 Correct 0 ms 348 KB Ok
3 Correct 0 ms 348 KB Ok
4 Correct 0 ms 348 KB Ok
5 Correct 0 ms 348 KB Ok
6 Correct 0 ms 348 KB Ok
7 Correct 0 ms 348 KB Ok
8 Correct 0 ms 344 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 172 ms 10580 KB Ok
2 Correct 80 ms 6976 KB Ok
3 Correct 1 ms 348 KB Ok
4 Correct 0 ms 348 KB Ok
5 Correct 1 ms 348 KB Ok
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 172 ms 10580 KB Ok
2 Correct 80 ms 6976 KB Ok
3 Correct 1 ms 348 KB Ok
4 Correct 0 ms 348 KB Ok
5 Correct 1 ms 348 KB Ok
6 Execution timed out 1062 ms 348 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -