# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
45968 | ernestvw | 별들과 삼각형 (IZhO11_triangle) | C++11 | 660 ms | 42272 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 <bits/stdc++.h>
using namespace std;
// cartesian tree
/*#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pd_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> Tree;
*/
// pragma
/*#pragma GCC optimize("O3")
#pragma GCC target("sse4")
*/
// defines
#define int long long
#define double long double
#define pb push_back
#define FOR(i, a, b) for(int i=a;i<(b);i++)
#define FORD(i, a, b) for(int i=(b)-1;i>=a;i--)
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define mp make_pair
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
// consts
const int MOD = 1e9+7;
const int oo = 1e9;
const int OO = 1e18;
const double eps = 1e-9;
const double PI = 4.0 * atan(1.0);
void solve();
signed main() {
fast_io();
solve();
return 0;
}
////////////////////42////////////////////
int n, X[400000], Y[400000];
void solve() {
cin>>n;
for(int i=0;i<n;i++)cin>>X[i]>>Y[i];
map<int, int>x,y;
for(int i=0;i<n;i++)x[X[i]]++,y[Y[i]]++;
int ans=0;
for(int i=0;i<n;i++)ans+=(x[X[i]]-1LL)*(y[Y[i]]-1LL);
cout<<ans<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |