# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166757 | Lightning | Star triangles (IZhO11_triangle) | C++14 | 561 ms | 9248 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.
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"
#define fo(a, b, c, d) for(int (a) = (b); (a) <= (c); (a) += (d))
#define foo(a, b, c ,d) for(int (a) = (b); (a) >= (c); (a) -= (d))
//#define int ll
const int N = 4e5;
const int INF = 1e9;
int n, x[N], y[N];
ll ans;
map <int, int> cntX, cntY;
int main () {
ios_base::sync_with_stdio(false);
cin >> n;
fo(i, 1, n, 1) {
cin >> x[i] >> y[i];
++cntX[x[i]];
++cntY[y[i]];
}
fo(i, 1, n, 1) {
ans += 1ll * (cntX[x[i]] - 1) * (cntY[y[i]] - 1);
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |