Submission #971964

# Submission time Handle Problem Language Result Execution time Memory
971964 2024-04-29T15:24:18 Z vjudge1 Star triangles (IZhO11_triangle) C++17
0 / 100
1 ms 428 KB
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

vector<pair<int, int>> p;

int main(){
  int n; cin >> n; 
  p.resize(n);
  for(int i = 0; i < n; i++) {
    int x, y; cin >> x >> y;
    p[i].first = x; p[i].second = y;
  }

  std::map<int, int> horizontal, vertical;

  for (auto const & x : p)
  {
      horizontal[x.first]++;
      vertical[x.second]++;
  }
  int ans = 0;
  for(int i = 0; i < n; i++) {
    int h = horizontal[p[i].first]-1;
    int v = vertical[p[i].second]-1;
    if(h > 0 && v > 0){
      horizontal[p[i].first]--;
      vertical[p[i].second]--;
      ans++;
    }
  }
  cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 428 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -