結果
問題 | No.2355 Unhappy Back Dance |
ユーザー |
![]() |
提出日時 | 2023-06-16 22:16:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,845 ms / 6,000 ms |
コード長 | 931 bytes |
コンパイル時間 | 2,299 ms |
コンパイル使用メモリ | 202,924 KB |
最終ジャッジ日時 | 2025-02-14 06:11:51 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll=long long;using ld=long double;ld pie=3.141592653589793;ll inf=200000000000000;ll mod=998244353;ll gcd(ll a, ll b) {a = abs(a); b = abs(b);if (a < b)swap(a, b);while (b) {ll r=a%b;a=b;b=r;}return a;}int main(){ll n;cin >> n;vector<ll>x(n),y(n);for (ll i = 0; i < n; i++){cin >> x[i] >> y[i];}ll ans=0;for (ll i = 0; i < n; i++){map<pair<ll,ll>,ll>memo;for (ll j = 0; j < n; j++){if (i==j){continue;}ll xx=(x[i]-x[j]),yy=y[i]-y[j];ll z=gcd(abs(xx),abs(yy));xx/=z;yy/=z;memo[{xx,yy}]+=1;if (memo[{xx,yy}]>=2){ans++;break;}}}cout << ans << endl;}