Submission #971223

# Submission time Handle Problem Language Result Execution time Memory
971223 2024-04-28T08:03:02 Z saidpon Star triangles (IZhO11_triangle) C++14
100 / 100
259 ms 17488 KB
#include <bits/stdc++.h>
#define ordered_set tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define nemeshay ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define allr(pon) pon.rbegin(), pon.rend()
#include <ext/pb_ds/assoc_container.hpp>
#define all(pon) pon.begin(), pon.end()
#include <ext/pb_ds/tree_policy.hpp>
#define pii pair <int, int>
#define nosolve puts("-1")
#define YES puts("YES")
#define pf push_front
#define int long long
#define OK puts("OK")
#define NO puts("NO")
#define pb push_back
#define sigma signed
#define sc second
#define fr first
using namespace __gnu_pbds;
using namespace std;
const int N = 1e6 + 20, INF = 2e9 + 7;
pii a[N];
sigma main(){
    nemeshay
    map <int, int> fir, sec;
    int n, ans = 0;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> a[i].fr >> a[i].sc;
        fir[a[i].fr]++;
        sec[a[i].sc]++;
    }
    for (int i = 0; i < n; i++){
        ans += (fir[a[i].fr] - 1) * (sec[a[i].sc] - 1);
    }
    cout << ans;
}
# 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 0 ms 468 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 1 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 5 ms 1368 KB Output is correct
13 Correct 5 ms 1372 KB Output is correct
14 Correct 8 ms 1924 KB Output is correct
15 Correct 84 ms 8532 KB Output is correct
16 Correct 97 ms 9004 KB Output is correct
17 Correct 84 ms 8528 KB Output is correct
18 Correct 87 ms 8532 KB Output is correct
19 Correct 232 ms 16620 KB Output is correct
20 Correct 173 ms 12896 KB Output is correct
21 Correct 246 ms 17236 KB Output is correct
22 Correct 259 ms 17488 KB Output is correct