hiho week 255 register

Ended

Participants:127

Verdict:Accepted
Score:100 / 100
Submitted:2019-05-22 14:33:06

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<stdio.h>
#include<unordered_map>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    unordered_map<int,int> c[4];
    int fg[4][2] = {{1,0},{0,1},{1,1},{1,-1}},res = 0;
    for(int i = 0;i<n;i++)
    {
        int x,y;
        scanf("%d %d",&x,&y);
        for(int j = 0;j<4;++j)
        {
            int k = x* fg[j][0] + y * fg[j][1];
            res += c[j][k];
            c[j][k]++;
        }
    }
    printf("%d",res);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX