Submission #877826

# Submission time Handle Problem Language Result Execution time Memory
877826 2023-11-23T16:39:45 Z __Davit__ Star triangles (IZhO11_triangle) C++17
100 / 100
249 ms 12176 KB
#include<bits/stdc++.h>

#define ll long long
#define lld long double
#define ff first
#define ss second
#define pb push_back
#define vr(v) v.begin(),v.end()
#define rv(v) v.rbegin(),v.rend()
#define Code ios_base::sync_with_stdio(false);
#define By cin.tie(NULL);
#define Davit cout.tie(NULL);
#define FOR(i, n) for(int i = 0;i<n;i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

//typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag,
//        tree_order_statistics_node_update> indexed_set;


//#include "algo/debug.h"


int main() {
    Code
    By
    Davit
    int n;
    cin >> n;
    map<int, int> X, Y;
    vector<pair<int, int>> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i].ff >> v[i].ss;
        X[v[i].ff]++;
        Y[v[i].ss]++;
    }

    ll ans = 0;
    for (int i = 0; i < n; i++) {
        int x = v[i].ff, y = v[i].ss;
        ans += 1ll * (X[x] - 1) * (Y[y] - 1);
    }
    cout << ans << endl;
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 464 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 5 ms 1116 KB Output is correct
13 Correct 5 ms 1116 KB Output is correct
14 Correct 7 ms 1372 KB Output is correct
15 Correct 80 ms 6088 KB Output is correct
16 Correct 88 ms 6496 KB Output is correct
17 Correct 98 ms 6116 KB Output is correct
18 Correct 80 ms 6224 KB Output is correct
19 Correct 210 ms 11680 KB Output is correct
20 Correct 174 ms 9392 KB Output is correct
21 Correct 249 ms 12100 KB Output is correct
22 Correct 234 ms 12176 KB Output is correct