제출 #1128433

#제출 시각아이디문제언어결과실행 시간메모리
1128433koukirocks"The Lyuboyn" code (IZhO19_lyuboyn)C++20
19 / 100
167 ms6544 KiB
#include <bits/stdc++.h> #define speed ios_base::sync_with_stdio(0); cin.tie(0) #define all(x) (x).begin(),(x).end() #define F first #define S second //#pragma GCC optimize("O3,unroll-loops") //#pragma GCC target("avx,avx2") //#pragma GCC target("popcnt") using namespace std; typedef long long ll; typedef unsigned long long ull; typedef double db; typedef long double ldb; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll MAX=2e5+10,P=1e9+7; const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f; const ldb eps=1e-6; const ldb PI=acos(-1.0); const int dir[4][2]={{0,1},{0,-1},{1,0},{-1,0}}; template<typename T> using vvector = vector<vector<T>>; void print(int x,int k) { for (int i=k-1;i>=0;i--) { cout<<bool(x&(1<<i)); } cout<<"\n"; } void gen(int n,vector<int> &seq,int now) { for (int i=0;i<(1<<n);i++) { seq.push_back(now); now=((1<<n)-1)^now; if (i&1) { now^=(-now&now)<<1; } else now^=1; } } int main() { speed; int n,k,t; string s; cin>>n>>k>>t; cin>>s; if (!(k&1) or n<=k) { cout<<"-1\n"; return 0; } int now=0; for (int i=0;i<n;i++) { now<<=1; now+=s[i]-'0'; } vector<int> seq; gen(k+1,seq,0); for (int i=k+1;i<n;i++) { for (int j=0;j<(1<<i);j++) { seq.push_back((1<<i)+seq[(1<<i)-j-1]); } } int id=0; for (int i=0;i<(1<<n);i++) { // cout<<seq[i]<<" "<<now<<" seq now\n"; if (seq[i]==now) id=i; } cout<<(1<<n)<<"\n"; for (int i=id;i<(1<<n);i++) print(seq[i],n); for (int i=0;i<id;i++) print(seq[i],n); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...