Cod sursa(job #1594761)
| Utilizator | Data | 9 februarie 2016 18:49:10 | |
|---|---|---|---|
| Problema | Triplete | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <fstream>
using namespace std;
ifstream f("triplete.in");
ofstream g("triplete.out");
int N,M,i,j,r;
char a[4100][600],b[4100][600];
int x[67000],y[67000];
int main()
{
f>>N>>M;
while(M--)
{
f>>x[M]>>y[M];
a[x[M]][y[M]>>3]|=(1<<(y[M]&7));
b[y[M]][x[M]>>3]|=(1<<(x[M]&7));
}
for(i=0;x[i];++i)
for(j=0;(j<<3)<=N;++j)
r+=__builtin_popcount(a[x[i]][j]&b[y[i]][j]);
g<<r;
return 0;
}
