結果
| 問題 |
No.1041 直線大学
|
| コンテスト | |
| ユーザー |
forest3
|
| 提出日時 | 2020-05-03 12:36:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 855 bytes |
| コンパイル時間 | 1,820 ms |
| コンパイル使用メモリ | 176,056 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 19:25:48 |
| 合計ジャッジ時間 | 2,950 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin >> N;
vector<pair<int, int>> XY( N );
for( int i = 0; i < N; i++ ) {
int X, Y;
cin >> X >> Y;
XY[i] = make_pair( X, Y );
}
const double EPS = 0.0000000001;
int ans = 0;
for( int b = 0; b <= 100; b++ ) {
for( int i = 0; i < N; i++ ) {
double a = (double)(XY[i].second - b) / XY[i].first;
int ans1 = 0;
for( int j = 0; j < N; j++ ) {
if( fabs( (double)(XY[j].second) - ( XY[j].first * a + b ) ) < EPS ) {
ans1++;
}
}
ans = max( ans, ans1 );
}
}
map<int, int> mp;
for( int i = 0; i < N; i++ ) {
mp[ XY[i].first ]++;
}
for( auto e : mp ) {
ans = max( ans, e.second );
}
map<int, int> mp1;
for( int i = 0; i < N; i++ ) {
mp1[ XY[i].second ]++;
}
for( auto e : mp1 ) {
ans = max( ans, e.second );
}
cout << ans << endl;
}
forest3