結果

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

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;

typedef modint998244353 mint;
typedef long long ll;

int main(){
	int n; cin >> n;
	vector<ll> x(n), y(n);
	for (int i=0; i<n; i++){
		cin >> x[i] >> y[i];
	}
	vector<set<pair<ll,ll>>> r;
	r.resize(n);
	vector<bool> mode(n);
	for (int i=0; i<n; i++){
		for (int j=0; j<n; j++){
			if (i == j) continue;
			ll xx = x[i] - x[j];
			ll yy = y[i] - y[j];
			ll g = __gcd(abs(xx), abs(yy));
			xx /= g;
			yy /= g;
			if (r[i].find(pair(xx, yy)) == r[i].end()){
				r[i].insert(pair(xx,yy));
			}else{
				mode[i] = true;
				break;
			}
		}
	}
	int ans = 0;
	for (int i=0; i<n; i++){
		if (mode[i]) ans++;
	}
	cout << ans << endl;	
}
0