結果
| 問題 |
No.1041 直線大学
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-01 21:25:57 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 926 bytes |
| コンパイル時間 | 1,230 ms |
| コンパイル使用メモリ | 100,632 KB |
| 最終ジャッジ日時 | 2025-01-10 04:09:15 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;
int main() {
int n;
cin >> n;
vector<int> xs(n), ys(n);
for (int i = 0; i < n; ++i) {
cin >> xs[i] >> ys[i];
}
int val = 0;
for (int i = 0; i < n; ++i) {
for (int j = i+1; j < n; ++j) {
int ans = 0;
int dy1 = ys[j]-ys[i], dx1 = xs[j]-xs[i];
for (int k = 0; k < n; ++k) {
int dy2 = ys[k]-ys[i], dx2 = xs[k]-xs[i];
if(dx2*dy1 == dx1*dy2) ans++;
}
val = max(ans, val);
}
}
cout << val << "\n";
return 0;
}