結果

問題 No.1041 直線大学
ユーザー KY2001KY2001
提出日時 2020-05-01 21:49:04
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 1,969 bytes
コンパイル時間 2,088 ms
コンパイル使用メモリ 202,484 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 09:10:38
合計ジャッジ時間 3,638 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 7 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 7 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 4 ms
4,380 KB
testcase_15 AC 3 ms
4,384 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 5 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 7 ms
4,376 KB
testcase_24 AC 5 ms
4,380 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 7 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int ceil_(int a, int b) { return (a + (b - 1)) / b; }
int bpm(int x, unsigned int y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (unsigned int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
void cumulative_sum(T container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}

signed main() {
  int N;
  cin >> N;
  vector<pair<int, int>> xy;
  rep(i, N) {
    int x, y;
    cin >> x >> y;
    xy.emplace_back(x, y);
  }
  int ans = 2;
  int temp_ans;
  rep(i, N - 1) {
    FOR(j, i + 1, N) {
      temp_ans = 0;
      rep(k, N) {
        if ((xy[i].first - xy[j].first) != 0) {
          if ((xy[i].second - xy[j].second) * (xy[k].first - xy[i].first) % (xy[i].first - xy[j].first) == 0) {
            if (xy[k].second == (xy[i].second - xy[j].second) * (xy[k].first - xy[i].first) / (xy[i].first - xy[j].first) + xy[i].second) temp_ans++;
          }
        }
      }
      ans = max(ans, temp_ans);
    }
  }
  FOR(i, 0, 101) {
    temp_ans = 0;
    rep(j, N) {
      if (xy[j].first == i) temp_ans++;
    }
    ans = max(ans, temp_ans);
  }
  FOR(i, 0, 101) {
    temp_ans = 0;
    rep(j, N) {
      if (xy[j].second == i) temp_ans++;
    }
    ans = max(ans, temp_ans);
  }
  cout << ans << endl;
}
0