Submission #959337

# Submission time Handle Problem Language Result Execution time Memory
959337 2024-04-08T03:55:06 Z Darren0724 "The Lyuboyn" code (IZhO19_lyuboyn) C++17
97 / 100
178 ms 5968 KB
#include <bits/stdc++.h>
using namespace std;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
#define int long long
#define all(x) x.begin(), x.end()
#define endl '\n'
const int N=200005;
const int INF=1e18;

int32_t main() {
    LCBorz;
    int n,k,t;cin>>n>>k>>t;
    string str;cin>>str;
    int s=0;
    for(char c:str){
        s=s<<1|(c&1);
    }
    vector<int> v(n+2);
    for(int i=0;i<=k;i++){
        v[i]=(1<<k+1)-(1<<i)-1;
        //01110
        //01101
        //01011
        //00111
        //10011
    }
    for(int i=k+1;i<n;i++){
        v[i]=(1<<i)+(1<<k-1)-1;
    }
    cout<<(1<<n)<<endl;
    for(int i=1;i<=(1<<n);i++){
        for(int j=n-1;j>=0;j--){
            cout<<((s>>j)&1);
        }
        cout<<endl;
        int p=__lg(i&(-i));
        s^=v[p];
    }
    return 0;
}

Compilation message

lyuboyn.cpp: In function 'int32_t main()':
lyuboyn.cpp:20:19: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   20 |         v[i]=(1<<k+1)-(1<<i)-1;
      |                  ~^~
lyuboyn.cpp:28:26: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   28 |         v[i]=(1<<i)+(1<<k-1)-1;
      |                         ~^~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Ok
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 344 KB Found solution while it does not exist
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 146 ms 5240 KB Ok
2 Correct 77 ms 2700 KB Ok
3 Correct 1 ms 348 KB Ok
4 Correct 0 ms 348 KB Ok
5 Correct 0 ms 348 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Ok
2 Correct 4 ms 456 KB Ok
3 Correct 74 ms 2644 KB Ok
4 Correct 40 ms 1504 KB Ok
5 Correct 1 ms 344 KB Ok
6 Correct 2 ms 500 KB Ok
7 Correct 16 ms 848 KB Ok
8 Correct 1 ms 344 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 151 ms 5388 KB Ok
2 Correct 161 ms 5204 KB Ok
3 Correct 155 ms 5312 KB Ok
4 Correct 75 ms 2680 KB Ok
5 Correct 72 ms 2640 KB Ok
6 Correct 36 ms 1476 KB Ok
7 Correct 37 ms 1392 KB Ok
8 Correct 16 ms 856 KB Ok
9 Correct 17 ms 860 KB Ok
10 Correct 8 ms 604 KB Ok
11 Correct 1 ms 344 KB Ok
12 Correct 1 ms 348 KB Ok
13 Correct 1 ms 344 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 146 ms 5240 KB Ok
2 Correct 77 ms 2700 KB Ok
3 Correct 1 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 4 ms 456 KB Ok
8 Correct 74 ms 2644 KB Ok
9 Correct 40 ms 1504 KB Ok
10 Correct 1 ms 344 KB Ok
11 Correct 2 ms 500 KB Ok
12 Correct 16 ms 848 KB Ok
13 Correct 1 ms 344 KB Ok
14 Correct 151 ms 5388 KB Ok
15 Correct 161 ms 5204 KB Ok
16 Correct 155 ms 5312 KB Ok
17 Correct 75 ms 2680 KB Ok
18 Correct 72 ms 2640 KB Ok
19 Correct 36 ms 1476 KB Ok
20 Correct 37 ms 1392 KB Ok
21 Correct 16 ms 856 KB Ok
22 Correct 17 ms 860 KB Ok
23 Correct 8 ms 604 KB Ok
24 Correct 1 ms 344 KB Ok
25 Correct 1 ms 348 KB Ok
26 Correct 1 ms 344 KB Ok
27 Correct 178 ms 5236 KB Ok
28 Correct 77 ms 2648 KB Ok
29 Correct 150 ms 5456 KB Ok
30 Correct 8 ms 600 KB Ok
31 Correct 1 ms 348 KB Ok
32 Correct 5 ms 456 KB Ok
33 Correct 16 ms 860 KB Ok
34 Correct 1 ms 348 KB Ok
35 Correct 0 ms 344 KB Ok
36 Correct 1 ms 348 KB Ok
37 Correct 0 ms 348 KB Ok
38 Correct 76 ms 2740 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 74 ms 2768 KB Ok
2 Correct 163 ms 5200 KB Ok
3 Correct 155 ms 5968 KB Ok
4 Correct 8 ms 604 KB Ok
5 Correct 1 ms 348 KB Ok
6 Correct 17 ms 856 KB Ok
7 Correct 149 ms 5216 KB Ok
8 Correct 1 ms 344 KB Ok
9 Correct 0 ms 348 KB Ok
10 Correct 1 ms 348 KB Ok
11 Correct 34 ms 1396 KB Ok
12 Correct 72 ms 2756 KB Ok