Cod sursa(job #993006)

Utilizator thewildnathNathan Wildenberg thewildnath Data 2 septembrie 2013 23:32:00
Problema Triplete Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 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,x,y;
    long long sol=0;
    scanf("%d%d",&n,&m);
    for(i=0;i<m;++i)
    {
        scanf("%d%d",&x,&y);
        f[min(x,y)-1][max(x,y)-1]=1;
        --x;
        --y;
        v[i].x=x;
        v[i].y=y;
    }
    for(i=0;i<m;++i)
        sol+=(long long)(f[v[i].x]&f[v[i].y]).count();
    printf("%lld\n",sol);
    return 0;
}