# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166002 | Dovran | Star triangles (IZhO11_triangle) | C++11 | 2 ms | 376 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>
#define N 400009
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define pii pair <ll, ll>
using namespace std;
ll n, ans;
map<ll, ll>a, b;
pii p[N];
int main(){
cin>>n;
for(int i=1; i<=n; i++)
cin>>p[i].ff>>p[i].ss, a[p[i].ff]++, b[p[i].ss]++;
for(int i=1; i<=n; i++)
ans+=max(a[p[i].ff]-1, b[p[i].ss]-1);
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |