QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#329960#7514. Clique ChallengeRegister_intWA 1ms5896kbC++141.2kb2024-02-17 10:02:032024-02-17 10:02:03

Judging History

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

  • [2024-02-17 10:02:03]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5896kb
  • [2024-02-17 10:02:03]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MAXN = 1e3 + 10;

vector<int> G[MAXN]; int id[MAXN];

ll f[1 << 22], g[1 << 22], h[44];

inline 
ll solve(vector<int> &p) {
	memset(id, 0xff, sizeof id);
	int n = p.size(), l = n >> 1, r = n - l; ll ans = 0;
	for (int i = 0; i < n; i++) id[p[i]] = i, h[i] = 1ll << i;
	for (int i = 0; i < n; i++) for (int v : G[p[i]]) if (~id[v]) h[i] |= 1ll << id[v];
	*f = (1ll << n) - 1, *g = 1;
	for (int i = 0; i < l; i++) f[1 << i] = h[i];
	for (int i = 1; i < 1 << l; i++) f[i] = f[i & i - 1] & f[i & -i];
	for (int i = 1; i < 1 << r; i++) g[i] = g[i & i - 1] + g[h[__builtin_ctz(i) + l] >> l & i & i - 1];
	for (int i = 0; i < 1 << l; i++) if ((i & f[i]) == i) ans += g[f[i] >> l];
	return ans;
}

int n, m, d[MAXN]; vector<int> p; ll ans;

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1, u, v; i <= m; i++) {
		scanf("%d%d", &u, &v), d[u]++, d[v]++;
		G[u].push_back(v), G[v].push_back(u);
	}
	for (int u = 1; u <= n; u++) {
		p.push_back(u);
		for (int v : G[u]) if (d[u] < d[v] || (d[u] == d[v] && u < v)) p.push_back(v);
		ans += solve(p), p.clear();
	}
	printf("%lld", ans);
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5896kb

input:

3 2
1 2
2 3

output:

10

result:

wrong answer 1st lines differ - expected: '5', found: '10'