QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#697724#5089. 环覆盖Yansuan_HCl0 0ms0kbC++141.9kb2024-11-01 15:29:562024-11-01 15:29:56

Judging History

你现在查看的是最新测评结果

  • [2024-11-01 15:29:56]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-11-01 15:29:56]
  • 提交

answer

#include <bits/stdc++.h>
#define ms(x, v) memset(x, v, sizeof(x))
#define il __attribute__((always_inline)) static
#define U(i,l,r) for(int i(l),END##i(r);i<=END##i;++i)
#define D(i,r,l) for(int i(r),END##i(l);i>=END##i;--i)
using namespace std;
using ll = long long;

#define IC isdigit(c)
#define GC c=getchar()
void rd(auto &x) { x = 0; char GC; bool f = 0;
	for (; !IC; GC) f |= c == '-';
	for (; IC; GC) x = x * 10 + c - 48;
	if (f) x = -x;
}
void rd(auto &x, auto &...y) { rd(x); rd(y...); }
#define meow(...) fprintf(stderr, __VA_ARGS__)
#define Assert(e, v) if (!(e)) { meow("AF@%d\n", __LINE__ ); exit(v); }

#define vc vector
#define eb emplace_back
#define pb push_back

const int N = 25, M = N * N;
const ll P = 1000000007;
void I(ll &x, ll v) { (x += v) %= P; }
ll qpow(ll x, ll t) { ll v = 1;
	for (; t; (x *= x) %= P, t >>= 1) if (t & 1)
		(v *= x) %= P;
	return v;
}

int n, m, to[N];
pair<int, int> eg[M];

using poly = array<ll, M>;
poly operator * (const poly &l, const poly &r) {
	poly f {};
	U (i, 0, M - 1) U (j, 0, M - i - 1)
		(f[i + j] += l[i] * r[j]) %= P;
	return f;
}

int main() {
	freopen("ava.in", "r", stdin);
	
	rd(n, m);
	U (i, 1, m) {
		auto &[u, v] = eg[i];
		rd(u, v); --u; --v;
		to[u] |= 1 << v; to[v] |= 1 << u;
	}
	int f[1 << N] {}, cnt[M] {};
	f[0] = m; cnt[m] = 1;
	U (s, 1, (1 << n) - 1) {
		int i = __builtin_ctz(s);
		int t = s ^ (1 << i);
		f[s] = f[t] + __builtin_popcount(to[i] & t) - __builtin_popcount(to[i] & ~t);
		++cnt[f[s]];
	}
	
	poly p1[M] {}, p0[M] {};
	p1[0][0] = p0[0][0] = p1[1][0] = p0[1][0] = 1;
	p1[1][1] = 1; p0[1][1] = P - 1;
	U (i, 2, M - 1) {
		p1[i] = p1[i - 1] * p1[1];
		p0[i] = p0[i - 1] * p0[1];
	}
	poly ans {}; ll coef = qpow(2, P - 1 - n);
	U (i, 0, m) {
		poly g = p1[i] * p0[m - i];
		U (j, 0, m)
			I(ans[j], g[j] * cnt[i]);
	}
	U (i, 0, m)
		printf("%lld ", ans[i] * coef %P);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 0
Time Limit Exceeded

input:

10 9
3 5
3 10
4 7
4 8
5 6
5 9
6 9
7 9
9 10

output:


result:


Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Time Limit Exceeded

Test #31:

score: 0
Time Limit Exceeded

input:

25 45
1 6
1 12
1 17
2 3
2 4
2 6
3 6
3 8
4 5
4 12
4 16
5 17
6 21
7 14
7 22
7 23
8 15
8 19
8 24
9 11
9 19
9 23
9 25
10 17
10 18
11 16
11 19
11 22
12 19
13 18
14 19
15 19
16 24
17 19
17 22
17 25
18 19
18 21
18 24
19 23
20 22
21 25
22 23
23 25
24 25

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%