Submission #532123

# Submission time Handle Problem Language Result Execution time Memory
532123 2022-03-02T06:19:53 Z kebine Star triangles (IZhO11_triangle) C++17
100 / 100
516 ms 14748 KB
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
typedef long long ll;
using namespace std;

ll n, ans;
pair<ll,ll>arr[300005];
map<ll,ll>x,y;

int main(){
  cin >> n;
  
  for(int i = 0; i < n; i++){
    cin >> arr[i].fi >> arr[i].se;
    x[arr[i].fi]++;
    y[arr[i].se]++;
  }
  for(int i = 0; i < n; i++){
    ans += (x[arr[i].fi]-1) * (y[arr[i].se]-1);
  }
  cout << ans << endl;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 304 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 2 ms 360 KB Output is correct
12 Correct 12 ms 1112 KB Output is correct
13 Correct 13 ms 1216 KB Output is correct
14 Correct 16 ms 1724 KB Output is correct
15 Correct 184 ms 7868 KB Output is correct
16 Correct 244 ms 8248 KB Output is correct
17 Correct 220 ms 7788 KB Output is correct
18 Correct 187 ms 7888 KB Output is correct
19 Correct 516 ms 14452 KB Output is correct
20 Correct 339 ms 11808 KB Output is correct
21 Correct 501 ms 14748 KB Output is correct
22 Correct 506 ms 14720 KB Output is correct