Submission #842322

# Submission time Handle Problem Language Result Execution time Memory
842322 2023-09-02T18:27:09 Z AndriaBeridze Star triangles (IZhO11_triangle) C++14
100 / 100
365 ms 15700 KB
#include<bits/stdc++.h>

using namespace std;
int TC = 0;

void dbg_out() {cout << endl;}
template<typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {cout << " " << H; dbg_out(T...);}
#define debug(...) {cout << "(" << #__VA_ARGS__ << "):"; dbg_out(__VA_ARGS__);}

#define IOS ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define int long long
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define add push_back
#define size(v) (int) v.size()
#define left node * 2, l, (l + r) / 2
#define right node * 2 + 1, (l + r) / 2 + 1, r
#define check() cout << "Why doesn't this stupid a** code work?" << endl;
#define inf (int) 1e18

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

signed main(){
    int q = 1;
    //cin >> q;
    while(++TC <= q){
    	solve();
    }
}
# 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 0 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 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 10 ms 1116 KB Output is correct
13 Correct 12 ms 1372 KB Output is correct
14 Correct 12 ms 1628 KB Output is correct
15 Correct 127 ms 8276 KB Output is correct
16 Correct 143 ms 8420 KB Output is correct
17 Correct 124 ms 7984 KB Output is correct
18 Correct 123 ms 7976 KB Output is correct
19 Correct 338 ms 14676 KB Output is correct
20 Correct 248 ms 11848 KB Output is correct
21 Correct 364 ms 15592 KB Output is correct
22 Correct 365 ms 15700 KB Output is correct