# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
420255 | cpp219 | Star triangles (IZhO11_triangle) | C++14 | 142 ms | 7716 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimization "O2"
#pragma GCC optimization "unroll-loop"
#pragma GCC target ("avx2")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fs first
#define sc second
using namespace std;
const ll N = 3e5 + 9;
const ll mod = 1e9 + 7;
typedef pair<ll,ll> LL;
unordered_map<ll,ll> mpx,mpy;
ll n,ans;
LL a[N];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
#define task "tst"
if (fopen(task".inp", "r")){
freopen(task".inp", "r", stdin);
//freopen(task".out", "w", stdout);
}
cin>>n;
for (ll i = 1;i <= n;i++){
cin>>a[i].fs>>a[i].sc;
mpx[a[i].fs]++; mpy[a[i].sc]++;
}
for (ll i = 1;i <= n;i++){
ll p = mpx[a[i].fs] - 1,q = mpy[a[i].sc] - 1;
ans += p*q;
}
cout<<ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |