結果
| 問題 |
No.1041 直線大学
|
| ユーザー |
unagiunag
|
| 提出日時 | 2020-05-01 22:04:18 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 927 bytes |
| コンパイル時間 | 692 ms |
| コンパイル使用メモリ | 72,248 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-25 10:35:24 |
| 合計ジャッジ時間 | 1,961 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 29 WA * 8 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
int main(){
int N;
std::cin >> N;
std::vector<std::pair<int,int>> xy(N);
for(int i=0;i<N;i++) std::cin >>xy[i].first>>xy[i].second;
int ans =2;
for(int i=0;i<N;i++){
for(int j=i+1;j<N;j++){
std::pair<int,int> grad ={xy[i].first-xy[j].first,xy[i].second-xy[j].second};
int cnt=2;
for(int k=0;k<N;k++){
if(k==i or k==j) continue;
if(grad.first==0) {
if(xy[i].first==xy[k].first)cnt++;
}
else if(grad.second==0){
if(xy[i].second==xy[k].second)cnt++;
}
else if(grad.first*xy[k].second == grad.second*xy[k].first)cnt++;
}
ans =std::max(ans,cnt);
}
}
std::cout <<ans<<std::endl;
}
unagiunag