Submission #977105

# Submission time Handle Problem Language Result Execution time Memory
977105 2024-05-07T11:44:30 Z vjudge1 Star triangles (IZhO11_triangle) C++17
100 / 100
262 ms 10424 KB
#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define nl "\n"
#define ll long long
#define str string
#define dl double
#define ts(val) to_string(val)
#define ti(val) stoi(val)
#define ft first
#define sc second
#define Pb push_back
#define pB pop_back
#define mp make_pair
#define mst(array,value) memset(array,value,sizeof(array))
#define gtr greater<int>()
#define all(ar) ar.begin(),ar.end()
using namespace std;

#define ull unsigned long long int

map<int, ll> cntX, cntY;

int main() {
    fast;
    int n; cin >> n;
    vector<pair<int, int>> xy;
    for(int i=0;i<n;i++) {
        int x, y; cin >> x >> y;
        xy.Pb(mp(x,y));
        cntX[x]++;
        cntY[y]++;
    }
    ll ans=0;
    for(auto it:xy) {
        ans += ((cntX[it.ft]-1) * (cntY[it.sc]-1));
    }
    cout << ans << nl;
    return 0;
}
# 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 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 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 940 KB Output is correct
13 Correct 5 ms 1116 KB Output is correct
14 Correct 8 ms 1628 KB Output is correct
15 Correct 91 ms 5100 KB Output is correct
16 Correct 94 ms 5052 KB Output is correct
17 Correct 91 ms 5104 KB Output is correct
18 Correct 87 ms 4896 KB Output is correct
19 Correct 262 ms 9920 KB Output is correct
20 Correct 174 ms 6344 KB Output is correct
21 Correct 255 ms 10424 KB Output is correct
22 Correct 253 ms 8892 KB Output is correct