# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
874965 | SevakYegoryan | Star triangles (IZhO11_triangle) | C++17 | 255 ms | 13336 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.
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <iterator>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <numeric>
#include <cassert>
#include <limits>
#include <climits>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define cdap(k) cout.setf(ios::fixed | ios::showpoint); cout.precision(k);
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb push_back
#define ff first
#define ss second
#define mkp make_pair
#define mkt make_tuple
#define pque priority_queue
const int INF = INT_MAX;
const long long LNF = LLONG_MAX;
const int N = 300003;
int x[N], y[N];
int n;
map<int, ll> mpx, mpy;
void solve()
{
int i, j;
cin >> n;
for (i = 1; i <= n; i++) {
cin >> x[i] >> y[i];
mpx[x[i]]++;
mpy[y[i]]++;
}
ll ans = 0LL;
for (i = 1; i <= n; i++) {
ans += (mpx[x[i]] - 1LL) * (mpy[y[i]] - 1LL);
}
cout << ans << "\n";
return;
}
int main()
{
fastIO;
int mt = 1;
//cin >> mt;
while(mt--) {
solve();
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |