General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
101940509 Practice:
luogu_bot4
1034E - 18 GNU C++11 Accepted 733 ms 51304 KB 2020-12-21 10:55:34 2020-12-21 10:55:34
→ Source
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = (1 << 21) + 5;
int n;
char s[MAX];
ll a[MAX], b[MAX], Pow[23], Count[MAX];
void FMT_or(ll *f, ll op) {
	for (int i = 1; i < (1 << n); i <<= 1) {
		for (int j = 0; j < (1 << n); j++) {
			if (!(j & i)) {
				f[j | i] = f[j | i] + f[j] * op;
			}
		}
	}
}
int main() {
	scanf("%d", &n);
	Pow[0] = 1;
	for (int i = 1; i <= n + 1; i++) Pow[i] = Pow[i - 1] * 4;
	for (int i = 1; i < (1 << n); i++) Count[i] = Count[i >> 1] + (i & 1);
	scanf("%s", s);
	for (int i = 0; i < (1 << n); i++) a[i] = 1ll * (s[i] - '0') * Pow[Count[i]];
	scanf("%s", s);
	for (int i = 0; i < (1 << n); i++) b[i] = 1ll * (s[i] - '0') * Pow[Count[i]];
	FMT_or(a, 1); FMT_or(b, 1);
	for (int i = 0; i < (1 << n); i++) a[i] = a[i] * b[i];
	FMT_or(a, -1);
	for (int i = 0; i < (1 << n); i++) printf("%lld", (a[i] / Pow[Count[i]]) & 3);
	return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details