Submission #24402

# Submission time Handle Problem Language Result Execution time Memory
24402 2017-06-07T08:09:45 Z Extazy Star triangles (IZhO11_triangle) C++14
100 / 100
689 ms 9156 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 1<<19;

int n;
pair < int, int > a[N];
long long ans;
map < int, int > cntx,cnty;

int main() {
    int i;

    scanf("%d", &n);
    for(i=1;i<=n;i++) {
        scanf("%d %d", &a[i].first, &a[i].second);
        ++cntx[a[i].first];
        ++cnty[a[i].second];
    }
    for(i=1;i<=n;i++) {
        ans+=(cntx[a[i].first]-1)*(cnty[a[i].second]-1);
    }
    printf("%lld\n", ans);

    return 0;
}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:15:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
triangle.cpp:17:50: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &a[i].first, &a[i].second);
                                                  ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 6120 KB Output is correct
2 Correct 0 ms 6120 KB Output is correct
3 Correct 0 ms 6120 KB Output is correct
4 Correct 0 ms 6120 KB Output is correct
5 Correct 0 ms 6120 KB Output is correct
6 Correct 0 ms 6120 KB Output is correct
7 Correct 0 ms 6120 KB Output is correct
8 Correct 0 ms 6120 KB Output is correct
9 Correct 0 ms 6120 KB Output is correct
10 Correct 0 ms 6120 KB Output is correct
11 Correct 0 ms 6120 KB Output is correct
12 Correct 6 ms 6648 KB Output is correct
13 Correct 3 ms 6648 KB Output is correct
14 Correct 13 ms 6912 KB Output is correct
15 Correct 233 ms 9024 KB Output is correct
16 Correct 256 ms 9156 KB Output is correct
17 Correct 226 ms 9024 KB Output is correct
18 Correct 206 ms 9024 KB Output is correct
19 Correct 613 ms 9156 KB Output is correct
20 Correct 416 ms 9156 KB Output is correct
21 Correct 689 ms 9156 KB Output is correct
22 Correct 639 ms 9156 KB Output is correct