Submission #1053642

# Submission time Handle Problem Language Result Execution time Memory
1053642 2024-08-11T14:52:43 Z vjudge1 Star triangles (IZhO11_triangle) C++17
100 / 100
223 ms 16424 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 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 1116 KB Output is correct
13 Correct 4 ms 1372 KB Output is correct
14 Correct 7 ms 1628 KB Output is correct
15 Correct 76 ms 7240 KB Output is correct
16 Correct 80 ms 7372 KB Output is correct
17 Correct 81 ms 7108 KB Output is correct
18 Correct 74 ms 7108 KB Output is correct
19 Correct 204 ms 16424 KB Output is correct
20 Correct 146 ms 10568 KB Output is correct
21 Correct 217 ms 16396 KB Output is correct
22 Correct 223 ms 14788 KB Output is correct