Submission #838650

# Submission time Handle Problem Language Result Execution time Memory
838650 2023-08-27T14:07:06 Z fanwen Star triangles (IZhO11_triangle) C++17
100 / 100
268 ms 12176 KB
/**
 *      author : pham van sam 
 *      created : 27 August 2023 (Sunday)
 **/

#include <bits/stdc++.h>

using namespace std;

const int MAXN = 3e5 + 5;

int N, x[MAXN], y[MAXN];
map <int, int> cnt_x, cnt_y;

void you_make_it(void) {
    cin >> N;
    for (int i = 1; i <= N; ++i) {
    	cin >> x[i] >> y[i];
    	cnt_x[x[i]]++, cnt_y[y[i]]++;
    }
    long long ans = 0;
    for (int i = 1; i <= N; ++i) {
    	ans += 1LL * (cnt_x[x[i]] - 1) * (cnt_y[y[i]] - 1);
    }
    cout << ans;
}

signed main() {

#ifdef LOCAL
    freopen("TASK.inp", "r", stdin);
    freopen("TASK.out", "w", stdout);
#endif
    auto start_time = chrono::steady_clock::now();

    cin.tie(0), cout.tie(0) -> sync_with_stdio(0);

    you_make_it();

    auto end_time = chrono::steady_clock::now();

    cerr << "\nExecution time : " << chrono::duration_cast <chrono::milliseconds> (end_time - start_time).count() << "[ms]" << endl;

    return (0 ^ 0);
}

// Dream it. Wish it. Do it.
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 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 340 KB Output is correct
12 Correct 5 ms 852 KB Output is correct
13 Correct 4 ms 852 KB Output is correct
14 Correct 7 ms 1108 KB Output is correct
15 Correct 82 ms 4032 KB Output is correct
16 Correct 86 ms 4104 KB Output is correct
17 Correct 80 ms 6200 KB Output is correct
18 Correct 82 ms 6080 KB Output is correct
19 Correct 268 ms 11548 KB Output is correct
20 Correct 156 ms 9172 KB Output is correct
21 Correct 249 ms 12176 KB Output is correct
22 Correct 235 ms 12096 KB Output is correct