Submission #167482

# Submission time Handle Problem Language Result Execution time Memory
167482 2019-12-08T16:34:03 Z Toirov_Sadi Star triangles (IZhO11_triangle) C++17
100 / 100
529 ms 12464 KB
#include <bits/stdc++.h>

#define fr first
#define se second

using namespace std;

const long long N = 3e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int n;
int a[N];
int b[N];
long long res;
map<int, int> x;
map<int, int> y;
int main()
{
    /// freopen("input.txt", "r", stdin);
    /// freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio( false );

    cin >> n;
    for(int i = 1; i <= n; i ++){
        cin >> a[i] >> b[i];
        x[a[i]] ++, y[b[i]] ++;
    }
    for(int i = 1; i <= n; i ++){
        res += (x[a[i]] - 1) * (y[b[i]] - 1);
    }cout << res << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 10 ms 1144 KB Output is correct
13 Correct 10 ms 1144 KB Output is correct
14 Correct 15 ms 1400 KB Output is correct
15 Correct 164 ms 6300 KB Output is correct
16 Correct 168 ms 6612 KB Output is correct
17 Correct 151 ms 6272 KB Output is correct
18 Correct 173 ms 6136 KB Output is correct
19 Correct 414 ms 11716 KB Output is correct
20 Correct 344 ms 9448 KB Output is correct
21 Correct 529 ms 12464 KB Output is correct
22 Correct 462 ms 12360 KB Output is correct