# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
336723 | 2020-12-16T14:18:32 Z | beksultan04 | "The Lyuboyn" code (IZhO19_lyuboyn) | C++14 | 131 ms | 9736 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define pii pair<int,int> #define OK puts("OK"); #define fr first #define sc second #define ret return #define scan1(a) scanf("%lld",&a); #define scan2(a,b) scanf("%lld %lld",&a, &b); #define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c); #define all(s) s.begin(),s.end() #define pb push_back #define sz(v) (int)v.size() #define endi puts(""); const int N = 5e5+12,INF=1e9+7; int q[N],p[N],dp[N]; main(){ int n,k,t,i,j; scan3(n,k,t) string s; cin>>s; if (k%2==0){ cout <<-1; ret 0; } vector <int> v; v.pb(0); v.pb(1); for (i=1;i<=k;++i){ int x = (1<<i); for (j=v.size()-1;j>=0;--j){ v.pb(x+v[j]); } } int x = (1<<i)-1; for (i=0;i<v.size();++i){ if (i%2)v[i]^=x; } for (i=k+1;i<n;++i){ int x = (1<<i),xr = (1<<(k-1))-1; for (j=v.size()-1;j>=0;--j){ v.pb(x+v[j]^xr); } } ///Answer cout <<v.size()<<"\n"; int cnt = v.size(); for (i=0;i<cnt;++i){ v.pb(v[i]); } bool f=0; for (i=0;i<v.size();++i){ if (cnt ==0)break; string t=""; for (j=0;j<n;++j){ if (v[i]&(1<<j)){ t+='1'; } else t+='0'; } if (s == t)f=1; if (f){ cout <<t<<"\n";cnt--; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Ok |
2 | Correct | 1 ms | 364 KB | Ok |
3 | Correct | 0 ms | 364 KB | Ok |
4 | Correct | 0 ms | 364 KB | Ok |
5 | Correct | 0 ms | 492 KB | Ok |
6 | Correct | 0 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 | Correct | 84 ms | 9556 KB | Ok |
2 | Correct | 39 ms | 4828 KB | Ok |
3 | Correct | 1 ms | 364 KB | Ok |
4 | Correct | 1 ms | 364 KB | Ok |
5 | Correct | 1 ms | 364 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Ok |
2 | Correct | 2 ms | 748 KB | Ok |
3 | Correct | 40 ms | 4900 KB | Ok |
4 | Correct | 19 ms | 2656 KB | Ok |
5 | Correct | 1 ms | 384 KB | Ok |
6 | Correct | 1 ms | 364 KB | Ok |
7 | Correct | 9 ms | 1508 KB | Ok |
8 | Correct | 1 ms | 364 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 95 ms | 9556 KB | Ok |
2 | Correct | 100 ms | 9556 KB | Ok |
3 | Correct | 105 ms | 9576 KB | Ok |
4 | Correct | 52 ms | 4956 KB | Ok |
5 | Correct | 52 ms | 4828 KB | Ok |
6 | Correct | 30 ms | 2656 KB | Ok |
7 | Correct | 19 ms | 2656 KB | Ok |
8 | Correct | 10 ms | 1508 KB | Ok |
9 | Correct | 13 ms | 1508 KB | Ok |
10 | Correct | 6 ms | 1000 KB | Ok |
11 | Correct | 1 ms | 364 KB | Ok |
12 | Correct | 1 ms | 364 KB | Ok |
13 | Correct | 1 ms | 364 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 84 ms | 9556 KB | Ok |
2 | Correct | 39 ms | 4828 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 | 2 ms | 748 KB | Ok |
8 | Correct | 40 ms | 4900 KB | Ok |
9 | Correct | 19 ms | 2656 KB | Ok |
10 | Correct | 1 ms | 384 KB | Ok |
11 | Correct | 1 ms | 364 KB | Ok |
12 | Correct | 9 ms | 1508 KB | Ok |
13 | Correct | 1 ms | 364 KB | Ok |
14 | Correct | 95 ms | 9556 KB | Ok |
15 | Correct | 100 ms | 9556 KB | Ok |
16 | Correct | 105 ms | 9576 KB | Ok |
17 | Correct | 52 ms | 4956 KB | Ok |
18 | Correct | 52 ms | 4828 KB | Ok |
19 | Correct | 30 ms | 2656 KB | Ok |
20 | Correct | 19 ms | 2656 KB | Ok |
21 | Correct | 10 ms | 1508 KB | Ok |
22 | Correct | 13 ms | 1508 KB | Ok |
23 | Correct | 6 ms | 1000 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 | 121 ms | 9684 KB | Ok |
28 | Correct | 53 ms | 4828 KB | Ok |
29 | Correct | 131 ms | 9556 KB | Ok |
30 | Correct | 5 ms | 1000 KB | Ok |
31 | Correct | 1 ms | 364 KB | Ok |
32 | Correct | 3 ms | 748 KB | Ok |
33 | Correct | 11 ms | 1508 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 | 61 ms | 4828 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 59 ms | 4828 KB | Ok |
2 | Correct | 126 ms | 9736 KB | Ok |
3 | Correct | 128 ms | 9508 KB | Ok |
4 | Correct | 6 ms | 1000 KB | Ok |
5 | Correct | 1 ms | 364 KB | Ok |
6 | Correct | 11 ms | 1508 KB | Ok |
7 | Correct | 109 ms | 9556 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 | 31 ms | 2656 KB | Ok |
12 | Correct | 56 ms | 4828 KB | Ok |