結果

問題 No.2355 Unhappy Back Dance
ユーザー SSRS
提出日時 2023-06-16 21:46:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,051 ms / 6,000 ms
コード長 597 bytes
コンパイル時間 2,043 ms
コンパイル使用メモリ 202,208 KB
最終ジャッジ日時 2025-02-14 05:08:30
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<long long> X(N), Y(N);
  for (int i = 0; i < N; i++){
    cin >> X[i] >> Y[i];
  }
  int ans = 0;
  for (int i = 0; i < N; i++){
    map<pair<long long, long long>, int> mp;
    for (int j = 0; j < N; j++){
      if (j != i){
        long long dx = X[j] - X[i];
        long long dy = Y[j] - Y[i];
        long long g = gcd(dx, dy);
        mp[make_pair(dx / g, dy / g)]++;
      }
    }
    for (auto P : mp){
      if (P.second >= 2){
        ans++;
        break;
      }
    }
  }
  cout << ans << endl;
}
0