Cod sursa(job #1907059)
Utilizator | Data | 6 martie 2017 17:38:12 | |
---|---|---|---|
Problema | Triplete | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <bits/stdc++.h>
using namespace std;
int m,n,i,j,in,sf,mid,nr,k,x,y;
vector<int>g[4196];
bitset<4196>b[4196];
int main()
{
ifstream f ("triplete.in");
ofstream G ("triplete.out");
f>>n>>m;
for(i=1; i<=m; ++i)
{
f>>x>>y;
g[x].push_back(y);
g[y].push_back(x);
b[x][y]=b[y][x]=1;
}
for(i=1; i<=n; ++i)
for(j=0; j<g[i].size(); ++j)
for(k=0; k<g[g[i][j]].size(); ++k)
if(b[i][g[g[i][j]][k]])++nr;
G<<nr/6;
return 0;
}