結果
| 問題 |
No.1041 直線大学
|
| コンテスト | |
| ユーザー |
qLethon
|
| 提出日時 | 2020-05-01 22:04:18 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,051 bytes |
| コンパイル時間 | 2,684 ms |
| コンパイル使用メモリ | 194,480 KB |
| 最終ジャッジ日時 | 2025-01-10 04:52:01 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> X(n), Y(n);
for (int i = 0; i < n; i++)
cin >> X[i] >> Y[i];
int ans = 0;
for (int i = 0; i < n; i++){
for (int j = i + 1; j < n; j++){
if (X[i] == X[j])
continue;
int dx = X[i] - X[j];
int dy = Y[i] - Y[j];
int res = 0;
for (int k = 0; k < n; k++){
if (dy * (X[k] - X[i]) % dx != 0)
continue;
int y = dy * (X[k] - X[i]) / dx + Y[i];
if (y == Y[k])
res++;
}
ans = max(ans, res);
}
}
for (int i = 0; i <= 100; i++){
int res = 0;
for (int j = 0; j < n; j++)
if (X[j] == 0)
res++;
ans = max(ans, res);
res = 0;
for (int j = 0; j < n; j++)
if (Y[j] == 0)
res++;
ans = max(ans, res);
}
cout << ans << endl;
}
qLethon