結果
| 問題 |
No.1041 直線大学
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-01 21:37:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 640 bytes |
| コンパイル時間 | 1,478 ms |
| コンパイル使用メモリ | 169,140 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-16 07:50:08 |
| 合計ジャッジ時間 | 2,552 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
int n;
cin >> n;
vector<pair<int,int>> vp(n);
for(int i = 0;i<n;i++)
{
int x,y;
cin >> x >> y;
vp[i] = make_pair(x,y);
}
int ans = 0;
for(int i = 0;i<n;i++)
{
for(int j = 0;j<n;j++)
{
if(i==j)continue;
int x = (vp[i].first-vp[j].first);
int y = (vp[i].second-vp[j].second);
int cnt = 0;
for(int k = 0;k <n;k++)
{
if(k==i||j==k)continue;
int X = (vp[k].first-vp[j].first);
int Y = (vp[k].second-vp[j].second);
if(y*X==Y*x)cnt++;
}
//cout<<cnt<<endl;
ans = max(ans,cnt+2);
}
}
cout<<ans<<endl;
}