0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

#864. 【2018.10雅礼集训day5】T3

https://sjzezoj.com/submission/25150
This commit is contained in:
Baoshuo Ren 2021-09-01 14:37:52 +08:00 committed by Baoshuo Ren
parent 88e8320a0a
commit 596dbe4d82
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

41
S2OJ/864/864.cpp Normal file
View File

@ -0,0 +1,41 @@
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
bool f[405];
bitset<405> g[405];
pair<int, int> e[50005];
int main() {
std::ios::sync_with_stdio(false);
cin >> n >> m;
for (int i = 1; i <= m; i++) {
cin >> e[i].first >> e[i].second;
}
for (int i = 1; i <= n; i++) {
g[i][i] = true;
for (int j = m; j > 0; j--) {
if (g[i][e[j].first] && g[i][e[j].second]) {
f[i] = true;
break;
}
if (g[i][e[j].first] || g[i][e[j].second]) {
g[i][e[j].first] = g[i][e[j].second] = true;
}
}
}
for (int i = 1; i <= n; i++) {
if (!f[i]) {
for (int j = i + 1; j <= n; j++) {
if (!f[j] && !(g[i] & g[j]).count()) {
ans++;
}
}
}
}
cout << ans << endl;
return 0;
}