답안 #370430

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
370430 2021-02-24T02:47:07 Z Kevin_Zhang_TW "The Lyuboyn" code (IZhO19_lyuboyn) C++17
0 / 100
249 ms 6380 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb emplace_back
#define AI(i) begin(i), end(i)
template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); }
template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); }
#ifdef KEV 
#define DE(args...) kout("[ " + string(#args) + " ] = ", args)
void kout() { cerr << endl; }
template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); }
template<class T> void debug(T L, T R) { while (L != R) cerr << *L << " \n"[next(L) == R], ++L; }
#else
#define DE(...) 0
#define debug(...) 0
#endif

const int MAX_N = 18, MAX_M = 1<<MAX_N;

int N, K, T, S;
int nxt[MAX_M];

void ob(int x) {
	for (int i = N-1;i >= 0;--i)
		cout << (x>>i&1);
	cout << '\n';
}
void divcons(int N, int f = 0) {
	if (N == 0) {
		nxt[f] = f^1;
		nxt[f^1] = f;
		DE(f, nxt[f]);
		return;
	}
	divcons(N-1, f);
	divcons(N-1,f|(1<<N));

	int X = f;
	for (int i = 1;i < (1<<(N));++i) {
		DE(i, X, nxt[X]);
		X = nxt[X];
	}
	DE(N, f, X);

	nxt[f] = f | (1<<N);
	nxt[X | (1<<N)] = f;

}
int32_t main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> N >> K >> T;
	{
		string v;
		cin >> v;
		DE(v);
		for (char i : v) 
			S = (S<<1) | (i-'0');
		DE(S);
	}

	if (K == 1 && T == 1) {
		divcons(N-1);
		cout << (1<<N) << '\n';
		for (int i = 0, x = S;i < 1<<N;++i) 
			ob(x), x = nxt[x];
	}
	else return -1;
}

Compilation message

lyuboyn.cpp: In function 'void divcons(int, int)':
lyuboyn.cpp:14:17: warning: statement has no effect [-Wunused-value]
   14 | #define DE(...) 0
      |                 ^
lyuboyn.cpp:32:3: note: in expansion of macro 'DE'
   32 |   DE(f, nxt[f]);
      |   ^~
lyuboyn.cpp:14:17: warning: statement has no effect [-Wunused-value]
   14 | #define DE(...) 0
      |                 ^
lyuboyn.cpp:40:3: note: in expansion of macro 'DE'
   40 |   DE(i, X, nxt[X]);
      |   ^~
lyuboyn.cpp:14:17: warning: statement has no effect [-Wunused-value]
   14 | #define DE(...) 0
      |                 ^
lyuboyn.cpp:43:2: note: in expansion of macro 'DE'
   43 |  DE(N, f, X);
      |  ^~
lyuboyn.cpp: In function 'int32_t main()':
lyuboyn.cpp:14:17: warning: statement has no effect [-Wunused-value]
   14 | #define DE(...) 0
      |                 ^
lyuboyn.cpp:55:3: note: in expansion of macro 'DE'
   55 |   DE(v);
      |   ^~
lyuboyn.cpp:14:17: warning: statement has no effect [-Wunused-value]
   14 | #define DE(...) 0
      |                 ^
lyuboyn.cpp:58:3: note: in expansion of macro 'DE'
   58 |   DE(S);
      |   ^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB The values in the output sequence are not pairwise distinct!
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 364 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 249 ms 6380 KB The values in the output sequence are not pairwise distinct!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 364 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 364 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 249 ms 6380 KB The values in the output sequence are not pairwise distinct!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 364 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -