# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
340854 | Edbert2397 | Star triangles (IZhO11_triangle) | C++14 | 2 ms | 364 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;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
#define pii pair<int,int>
const int N = 3e5 + 5;
const int INF = 1e9;
const ll mod = 1e9+7;
int x[N],y[N];
map<int,int>row,col;
int n;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
freopen("triangles.in","r",stdin);
freopen("triangles.out","w",stdout);
cin>>n;
for(int i = 1;i<=n;i++){
cin>>x[i]>>y[i];
row[x[i]]++;
col[y[i]]++;
}
ll ans = 0;
for(int i = 1;i<=n;i++){
ans += (1LL * (row[x[i]]-1) * (col[y[i]]-1));
}
cout<<ans<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |