結果

問題 No.1041 直線大学
ユーザー unagiunag
提出日時 2020-05-01 21:41:22
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 695 bytes
コンパイル時間 727 ms
コンパイル使用メモリ 72,192 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 01:46:09
合計ジャッジ時間 2,054 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 18 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#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*xy[k].second==grad.second&xy[k].first)cnt++;
                
            }
            ans =std::max(ans,cnt);
        }
    }
    std::cout <<ans<<std::endl;
}
0