Submission #76848

# Submission time Handle Problem Language Result Execution time Memory
76848 2018-09-18T15:45:31 Z win11905 Star triangles (IZhO11_triangle) C++11
100 / 100
679 ms 39104 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 3e5+5;

int n, X[N], Y[N];
map<int, int> x, y;

int main() {
    scanf("%d", &n);
    for(int i = 0; i < n; ++i) {
        scanf("%d %d", X+i, Y+i);
        x[X[i]]++, y[Y[i]]++;
    }
    long long sum = 0;
    for(int i = 0; i < n; ++i) 
        sum += 1ll * (x[X[i]] - 1) * (y[Y[i]] - 1);
    printf("%lld\n", sum);
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
triangle.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", X+i, Y+i);
         ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 472 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 2 ms 536 KB Output is correct
5 Correct 2 ms 540 KB Output is correct
6 Correct 2 ms 588 KB Output is correct
7 Correct 3 ms 720 KB Output is correct
8 Correct 2 ms 724 KB Output is correct
9 Correct 2 ms 772 KB Output is correct
10 Correct 3 ms 780 KB Output is correct
11 Correct 3 ms 844 KB Output is correct
12 Correct 10 ms 1556 KB Output is correct
13 Correct 12 ms 1816 KB Output is correct
14 Correct 18 ms 2288 KB Output is correct
15 Correct 175 ms 7408 KB Output is correct
16 Correct 207 ms 9712 KB Output is correct
17 Correct 179 ms 11748 KB Output is correct
18 Correct 190 ms 13996 KB Output is correct
19 Correct 473 ms 21556 KB Output is correct
20 Correct 363 ms 25252 KB Output is correct
21 Correct 509 ms 32368 KB Output is correct
22 Correct 679 ms 39104 KB Output is correct