Submission #531498

# Submission time Handle Problem Language Result Execution time Memory
531498 2022-03-01T00:02:33 Z andecaandeci Star triangles (IZhO11_triangle) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
  cin.tie(0) -> ios_base::sync_with_stdio(0);

  int n;
  cin >> n;
  vector<int> x(n), y(n);
  map<int,int> px, py;
  for(int i=0;i<n;i++)
  {
    cin >> x[i] >> y[i];
    if(px.count(x[i]))
    {
      px[y[i]]++;
    }
    else
    {
      px[x[i]] = 1;
    }
    if(py.count(y[i]))
    {
      py[y[i]]++;
    }
    else
    {
      py[y[i]] = 1;
    }
  }
  int ans = 0;
  for(int i=0;i<n;i++)
  {
    int cx = 0, cy = 0;
    if(px.count(x[i])) cx = px[x[i]];
    if(py.count(y[i])) cy = py[y[i]];
    ans += (cx - 1) * (cy - 1);
  }
  cout << ans << '
';
  
}

Compilation message

triangle.cpp:39:18: warning: missing terminating ' character
   39 |   cout << ans << '
      |                  ^
triangle.cpp:39:18: error: missing terminating ' character
triangle.cpp:40:1: warning: missing terminating ' character
   40 | ';
      | ^
triangle.cpp:40:1: error: missing terminating ' character
   40 | ';
      | ^~
triangle.cpp: In function 'int main()':
triangle.cpp:42:1: error: expected primary-expression before '}' token
   42 | }
      | ^