結果
| 問題 |
No.2355 Unhappy Back Dance
|
| コンテスト | |
| ユーザー |
planes
|
| 提出日時 | 2023-06-16 22:53:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,800 ms / 6,000 ms |
| コード長 | 739 bytes |
| コンパイル時間 | 1,755 ms |
| コンパイル使用メモリ | 174,612 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-24 15:52:31 |
| 合計ジャッジ時間 | 23,783 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
ll INF=2e18;
long long GCD(long long a, long long b) {
if (b == 0) return a;
else return GCD(b, a % b);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
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++) {
bool ok=false;
set<pair<ll,ll>> S;
for(ll j=0;j<N;j++) {
if(i==j) continue;
ll x=X[j]-X[i];
ll y=Y[j]-Y[i];
ll d=GCD(abs(x),abs(y));
if(S.count(make_pair(x/d,y/d))) ok=true;
else S.insert(make_pair(x/d,y/d));
}
if(ok) ans++;
}
cout<<ans<<endl;
}
planes