# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
499007 | beksultan04 | Star triangles (IZhO11_triangle) | C++14 | 0 ms | 204 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;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define int long long
#define pii pair<int,int>
#define ret return
#define fr first
#define sc second
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define nosol puts("-1");
#define pb push_back
#define endi puts("");
const int N = 1e6+12,INF = 1e15+7;
#define ordered_set tree <int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
int y[N],x[N];
main(){
int n,i,ans=0;
cin>>n;
map<int,int> mpx,mpy;
for (i=1;i<=n;++i){
cin>>x[i]>>y[i];
mpx[x[i]]++;
mpy[y[i]]++;
}
for (i=1;i<=n;++i){
ans += (mpx[x[i]]-1)*(mpx[y[i]]-1);
mpx[x[i]]--;
mpy[y[i]]--;
}
cout <<ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |