Submission #866139

#TimeUsernameProblemLanguageResultExecution timeMemory
866139dilanyanStar triangles (IZhO11_triangle)C++17
100 / 100
251 ms13396 KiB
//-------------dilanyan------------\\
 
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;

//------------------KarginDefines--------------------\\
 
#define ll long long
#define pb push_back
#define all(u) (u).begin(), (u).end()
#define pqueue priority_queue
#define upper upper_bound
#define lower lower_bound
#define umap unordered_map
#define uset unordered_setq
#define Kargin ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Usaco freopen(".in", "r", stdin); freopen(".out", "w", stdout);


//-------------------KarginConstants------------------\\
 
const ll mod = 1000000007;
const ll inf = 1e9;

//-------------------KarginCode------------------------\\
 
const int N = 300005;
int x[N], y[N];
map<int, ll> mx, my;

void KarginSolve() {
    int n; cin >> n;
    for (int i = 0; i < n;i++) {
        cin >> x[i] >> y[i];
        mx[x[i]]++, my[y[i]]++;
    }
    ll ans = 0;
    for (int i = 0;i < n;i++) ans += (mx[x[i]] - 1) * (my[y[i]] - 1);
    cout << ans << '\n';
}

int main() {
    // Usaco
    Kargin;
    int test = 1;
    //cin >> test;
    while (test--) {
        KarginSolve();
    }
    return 0;
}

// There is nothing we can do

Compilation message (stderr)

triangle.cpp:1:1: warning: multi-line comment [-Wcomment]
    1 | //-------------dilanyan------------\\
      | ^
triangle.cpp:8:1: warning: multi-line comment [-Wcomment]
    8 | //------------------KarginDefines--------------------\\
      | ^
triangle.cpp:22:1: warning: multi-line comment [-Wcomment]
   22 | //-------------------KarginConstants------------------\\
      | ^
triangle.cpp:27:1: warning: multi-line comment [-Wcomment]
   27 | //-------------------KarginCode------------------------\\
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...