結果

問題 No.1041 直線大学
コンテスト
ユーザー あるふぁ
提出日時 2026-09-09 17:24:58
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 529 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,216 ms
コンパイル使用メモリ 356,684 KB
実行使用メモリ 10,028 KB
最終ジャッジ日時 2026-09-09 17:25:20
合計ジャッジ時間 9,239 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<pair<int, int>> A(N);
  for (auto& [x, y] : A) cin >> x >> y;
  
  int ans = 0;
  for (int i = 0; i <= 100; i++){
    int cnt = ranges::count_if(A, [&](auto x){return x.first == i;});
    ans = max(ans, cnt);
  }
  for (int a = -100; a <= 100; a++){
    for (int b = -10000; b <= 10000; b++){
      int cnt = ranges::count_if(A, [&](auto x){return a*x.first+b == x.second;});
      ans = max(ans, cnt);
    }
  }
  
  cout << ans << endl;
}
0