結果
| 問題 |
No.1041 直線大学
|
| コンテスト | |
| ユーザー |
hitonanode
|
| 提出日時 | 2020-05-01 22:46:40 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 647 bytes |
| コンパイル時間 | 775 ms |
| コンパイル使用メモリ | 72,224 KB |
| 最終ジャッジ日時 | 2025-01-10 05:20:00 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
using pint = pair<int, int>;
bool kyosen(pint a, pint b, pint c)
{
int x1 = b.first - a.first, x2 = c.first - a.first;
int y1 = b.second - a.second, y2 = c.second - a.second;
return x1 * y2 - x2 * y1 == 0;
}
int main()
{
int N;
cin >> N;
vector<pint> P(N);
for (auto &p : P) cin >> p.first >> p.second;
int ret = 0;
for (int i = 0; i < N; i++) for (int j = 0; j < i; j++)
{
int tmp = 0;
for (int k = 0; k < N; k++) tmp += kyosen(P[i], P[j], P[k]);
ret = max(ret, tmp);
}
cout << ret << '\n';
}
hitonanode