Submission #19139

# Submission time Handle Problem Language Result Execution time Memory
19139 2016-02-18T17:31:48 Z eaststar Star triangles (IZhO11_triangle) C++14
100 / 100
535 ms 8936 KB
#include <stdio.h>
#include <map>
using namespace std;
#define SZ 300010
map<int,int> a,b;
int x[SZ],y[SZ],xcnt[SZ],ycnt[SZ],s,t;
long long ans;
int main(){
    int i,n;
    scanf("%d",&n);
    for(i=1;i<=n;++i){
        scanf("%d%d",x+i,y+i);
        if(!a[x[i]])a[x[i]]=++s;
        ++xcnt[a[x[i]]];
        if(!b[y[i]])b[y[i]]=++t;
        ++ycnt[b[y[i]]];
    }
    for(i=1;i<=n;++i)ans+=(long long)(xcnt[a[x[i]]]-1)*(ycnt[b[y[i]]]-1);
    printf("%lld",ans);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5900 KB Output is correct
2 Correct 0 ms 5900 KB Output is correct
3 Correct 0 ms 5900 KB Output is correct
4 Correct 0 ms 5900 KB Output is correct
5 Correct 0 ms 5900 KB Output is correct
6 Correct 0 ms 5900 KB Output is correct
7 Correct 0 ms 5900 KB Output is correct
8 Correct 0 ms 5900 KB Output is correct
9 Correct 0 ms 5900 KB Output is correct
10 Correct 1 ms 5900 KB Output is correct
11 Correct 0 ms 5900 KB Output is correct
12 Correct 8 ms 6296 KB Output is correct
13 Correct 10 ms 6296 KB Output is correct
14 Correct 14 ms 6692 KB Output is correct
15 Correct 169 ms 8804 KB Output is correct
16 Correct 201 ms 8804 KB Output is correct
17 Correct 162 ms 8804 KB Output is correct
18 Correct 180 ms 8804 KB Output is correct
19 Correct 476 ms 8936 KB Output is correct
20 Correct 357 ms 8936 KB Output is correct
21 Correct 439 ms 8936 KB Output is correct
22 Correct 535 ms 8936 KB Output is correct