結果
| 問題 | No.1041 直線大学 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-05-29 20:39:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 1,111 bytes |
| コンパイル時間 | 1,641 ms |
| コンパイル使用メモリ | 114,240 KB |
| 最終ジャッジ日時 | 2025-01-21 20:38:04 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main() {
int32_t n;
cin >> n;
vector<pair<int32_t, int32_t>> xys(n);
for (auto &&xy : xys) {
cin >> xy.first >> xy.second;
}
int32_t ans = 0;
for (auto i = 0; i < n; ++i) {
auto x1 = xys[i].first, y1 = xys[i].second;
for (auto j = 0; j < n; ++j) {
if (i == j)
continue;
auto x2 = xys[j].first, y2 = xys[j].second;
int32_t c = 2;
for (auto k = 0; k < n; ++k) {
if (k == i || k == j)
continue;
auto x3 = xys[k].first, y3 = xys[k].second;
if ((y3 - y1) * (x1 - x2) == (x3 - x1) * (y1 - y2))
++c;
}
ans = max(ans, c);
}
}
cout << ans << endl;
return 0;
}