답안 #161904

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
161904 2019-11-05T09:10:42 Z MvC "The Lyuboyn" code (IZhO19_lyuboyn) C++11
3 / 100
51 ms 2740 KB
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e6+50;
const int mod=1e9+7;
using namespace std;
int n,k,tp,i,j,t,s,msk,a[nmax],nr,rs,v[nmax];
vector<int>vc;
char c;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>k>>tp;
	for(i=0;i<n;i++)
	{
		cin>>c;
		if(c=='1')s|=(1<<(n-i-1));
	}
	for(i=0;i<(1<<n);i++)
	{
		if(__builtin_popcount(i)==k)a[j++]=i;
	}
	//shuffle(a,a+j,rng);
	v[s]=1;
	vc.pb(s);
	for(i=1;i<(1<<n);i++)
	{
		nr=0;
		while(v[s^msk^a[t]] && nr<=j+5)t=(t+1)%j,nr++;
		if(nr>j+5)rc(-1);
		msk^=a[t];
		vc.pb(s^msk);
		v[s^msk]=1;
	}
	rs=(1<<n);
	cout<<rs<<endl;
	for(i=0;i<rs;i++)
	{
		for(j=n-1;j>=0;j--)
		{
			if(vc[i]&(1<<j))cout<<1;
			else cout<<0;
		}
		cout<<'\n';
	}
	return 0;
}

Compilation message

lyuboyn.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
lyuboyn.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Not a cycle!
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Ok
2 Correct 12 ms 2040 KB Ok
3 Correct 15 ms 1272 KB Ok
4 Correct 2 ms 376 KB Ok
5 Correct 2 ms 376 KB Ok
6 Correct 2 ms 376 KB Ok
7 Correct 9 ms 376 KB Ok
8 Correct 11 ms 1272 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 2548 KB Output -1 while solution exists
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Ok
2 Incorrect 3 ms 504 KB Output -1 while solution exists
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 51 ms 2740 KB Output -1 while solution exists
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 2548 KB Output -1 while solution exists
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 1528 KB Output -1 while solution exists
2 Halted 0 ms 0 KB -