結果
| 問題 | No.1041 直線大学 |
| コンテスト | |
| ユーザー |
Series_205
|
| 提出日時 | 2020-05-01 21:52:34 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 864 bytes |
| コンパイル時間 | 2,328 ms |
| コンパイル使用メモリ | 193,180 KB |
| 最終ジャッジ日時 | 2025-01-10 04:40:58 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
inline bool in(int x, int y) {
return x >= 0 && x <= 100 && y >= 0 && y <= 100;
}
int main() {
int n;
cin >> n;
int x[109], y[109];
bool f[109][109]{};
for(int i = 0; i < n; i++)
cin >> x[i] >> y[i], f[x[i]][y[i]] = true;
int ans = 0;
for(int i = 0; i < n; i++) {
for(int j = 0; j < i; j++) {
int dx = x[i] - x[j];
int dy = y[i] - y[j];
int g = gcd(dx, dy);
dx /= g;
dy /= g;
int cnt = 0;
for(int xx = x[i], yy = y[i]; in(xx, yy); xx += dx, yy += dy)
cnt += f[xx][yy];
for(int xx = x[i], yy = y[i]; in(xx -= dx, yy -= dy);)
cnt += f[xx][yy];
ans = max(ans, cnt);
}
}
cout << ans << endl;
}
Series_205