Cod sursa(job #993012)

Utilizator thewildnathNathan Wildenberg thewildnath Data 2 septembrie 2013 23:35:28
Problema Triplete Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.58 kb
#include<stdio.h>
#include<bitset>
using namespace std;
typedef struct punct
{
    int x,y;

}punct;
punct v[65538];
bitset <4098> f[4098];
int main()
{
    freopen("triplete.in","r",stdin);
    freopen("triplete.out","w",stdout);
    int n,m,i,sol=0;
    scanf("%d%d",&n,&m);
    for(i=0;i<m;++i)
    {
        scanf("%d%d",&v[i].x,&v[i].y);
        --v[i].x;
        --v[i].y;
        f[v[i].x][v[i].y]=1;
        f[v[i].y][v[i].x]=1;
    }
    for(i=0;i<m;++i)
        sol+=(f[v[i].x]&f[v[i].y]).count();
    sol/=3;
    printf("%d\n",sol);
    return 0;
}