結果
| 問題 |
No.1041 直線大学
|
| コンテスト | |
| ユーザー |
woyuki_
|
| 提出日時 | 2020-05-01 22:06:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,722 bytes |
| コンパイル時間 | 2,149 ms |
| コンパイル使用メモリ | 169,056 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-25 10:55:16 |
| 合計ジャッジ時間 | 3,357 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 WA * 7 |
ソースコード
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int) n; i++)
#define repb(i, n) for (int i = (int) n; i >= 0; i--)
#define reps(i, m, n) for (int i = (int) m; i < (int) n; i++)
#define repsb(i, m, n) for (int i = (int) m; i >= (int) n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
# define pb(a) push_back(a)
#define ll long long int
int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return 1; } return 0; }
template < class T > bool chmin(T & a,const T & b) { if (b < a) { a = b; return 1; } return 0; }
//vector<vector<int>> vec(n_rows, vector<int>(n_cols, value));
using namespace std;
int main(int argc, char const * argv[]){
int n;
cin >> n;
typedef pair<int, int> pair;
vector<pair> xy(n);
vector<pair> d(n); //a,b
rep(i, n)
{
cin >> xy[i].first >> xy[i].second;
}
int cnt = 2;
rep(i, n)
{
rep(j,n){
int tmp = 0;
if (i == j ||xy[i].first-xy[j].first==0)
continue;
double t = (xy[i].second - xy[j].second) / (xy[i].first - xy[j].first);
//cout << t << endl;
double b = xy[j].second - t * xy[j].first;
//cout << b << endl;
rep(p,n){
// cout << "ans" << (int)(xy[p].second + 0.5) <<"\tans2 "<<(int)(t + 0.5) * xy[p].first + (int)(b + 0.5)<<endl;
if ((int)(xy[p].second + 0.5) == (int)(t + 0.5) * xy[p].first + (int)(b + 0.5))
{
tmp++;
}
}
cnt = max(cnt, tmp);
}
}
cout<<cnt<<endl;
return 0;
}
woyuki_