Submission #598767

# Submission time Handle Problem Language Result Execution time Memory
598767 2022-07-19T02:19:44 Z sumit_kk10 Star triangles (IZhO11_triangle) C++17
100 / 100
347 ms 15568 KB
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define F first
#define S second
#define int long long
using namespace std;
const int N = 1e6 + 5, MOD = 1e9 + 7;
int n, x[N], y[N];

void solve(){
    cin >> n;
    map<int, int> cmp, cmp1;
    for(int i = 0; i < n; ++i){
        cin >> x[i] >> y[i];
        cmp[y[i]]++;
        cmp1[x[i]]++;
    }
    int ans = 0;
    for(int i = 0; i < n; ++i)
        ans += (cmp[y[i]] - 1) * (cmp1[x[i]] - 1);
    cout << ans << '\n';
}

int32_t main(){
    fast;
    int t = 1;
    // cin >> t;
    while(t--)
        solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 388 KB Output is correct
12 Correct 7 ms 1236 KB Output is correct
13 Correct 6 ms 1240 KB Output is correct
14 Correct 13 ms 1784 KB Output is correct
15 Correct 101 ms 7844 KB Output is correct
16 Correct 106 ms 8268 KB Output is correct
17 Correct 102 ms 7944 KB Output is correct
18 Correct 114 ms 7880 KB Output is correct
19 Correct 264 ms 14668 KB Output is correct
20 Correct 214 ms 11936 KB Output is correct
21 Correct 331 ms 15448 KB Output is correct
22 Correct 347 ms 15568 KB Output is correct