Cod sursa(job #3193596)
| Utilizator | Data | 14 ianuarie 2024 23:34:38 | |
|---|---|---|---|
| Problema | Triplete | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <iostream>
#include <fstream>
#include <algorithm>
#include <bitset>
#include <map>
using namespace std;
ifstream fin("triplete.in");
ofstream fout("triplete.out");
bitset<4096>a[4096];
int n, m;
int main()
{
int i, j, x, y;
fin >> n >> m;
for (i = 0; i < m; i++)
{
fin >> x >> y;
x--; y--;
if (y > x)swap(x, y);
a[y].set(x);
}
y = 0;
for (i = 0; i < n-1; i++)
for (j = i + 1; j < n; j++)
{
x=(a[i] & a[j]).count();
y += x;
}
fout << y;
return 0;
}