Submission #476228

# Submission time Handle Problem Language Result Execution time Memory
476228 2021-09-25T12:49:38 Z kkk Star triangles (IZhO11_triangle) C++14
100 / 100
146 ms 14176 KB
#include<unordered_map>
#include<iostream>
#define endl '\n'
using namespace std;
long long x[10000000], y[10000000], n, m;
unordered_map<long long, long long>a, b;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    long long i,j, br=0;

    cin>>n;

    for(i=0;i<n;i++)
    {
        cin>>x[i]>>y[i];
        a[x[i]]++; b[y[i]]++;
    }

    for(i=0;i<n;i++)
    {
        br+=(a[x[i]]-1)*(b[y[i]]-1);
    }

    cout<<br<<endl;

}

Compilation message

triangle.cpp: In function 'int main()':
triangle.cpp:13:17: warning: unused variable 'j' [-Wunused-variable]
   13 |     long long i,j, br=0;
      |                 ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 0 ms 332 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 5 ms 972 KB Output is correct
13 Correct 6 ms 972 KB Output is correct
14 Correct 9 ms 1356 KB Output is correct
15 Correct 45 ms 6568 KB Output is correct
16 Correct 56 ms 6988 KB Output is correct
17 Correct 45 ms 6640 KB Output is correct
18 Correct 44 ms 6556 KB Output is correct
19 Correct 140 ms 13324 KB Output is correct
20 Correct 84 ms 10412 KB Output is correct
21 Correct 146 ms 14176 KB Output is correct
22 Correct 131 ms 14088 KB Output is correct