Submission #881919

# Submission time Handle Problem Language Result Execution time Memory
881919 2023-12-02T09:04:13 Z dosts Star triangles (IZhO11_triangle) C++17
100 / 100
254 ms 20412 KB
#include <bits/stdc++.h>
using namespace std;
#define sp << " " << 
#define int long long
#define vi vector<int>
#define F(xxx,yyy) for (int xxx=1;xxx<=yyy;xxx++)
#define pii pair<int,int>
const int N = 5e5+1,inf = 1e18;

void solve() {
  int n;
  cin >> n;
  map<int,int> xc,yc;
  vector<pii> ps;
  F(i,n) {
    int a,b;
    cin >> a >> b;
    xc[a]++;
    yc[b]++;
    ps.push_back({a,b});
  }
  int ans = 0;
  for (auto it : ps) {
    ans+=(xc[it.first]-1)*(yc[it.second]-1);
  }
  cout << ans << endl;
}	
    
                  
                             
signed main() { 
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  #ifdef Local
  freopen("in","r",stdin);
  freopen("out","w",stdout);
  #endif
  int t = 1;
  //cin >> t;
	F(i,t) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 408 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 456 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 6 ms 1308 KB Output is correct
13 Correct 5 ms 1372 KB Output is correct
14 Correct 8 ms 1752 KB Output is correct
15 Correct 84 ms 8032 KB Output is correct
16 Correct 92 ms 8456 KB Output is correct
17 Correct 86 ms 7964 KB Output is correct
18 Correct 85 ms 7876 KB Output is correct
19 Correct 237 ms 20368 KB Output is correct
20 Correct 169 ms 12404 KB Output is correct
21 Correct 253 ms 20408 KB Output is correct
22 Correct 254 ms 20412 KB Output is correct