結果
問題 |
No.1041 直線大学
|
ユーザー |
![]() |
提出日時 | 2020-09-13 01:07:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 759 bytes |
コンパイル時間 | 1,542 ms |
コンパイル使用メモリ | 168,332 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 08:08:55 |
合計ジャッジ時間 | 2,605 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
// No.1041 直線大学 #include <bits/stdc++.h> #define rep(i, n) for(int i=0; i<(int)(n); i++) using namespace std; using ll = long long; using ull = unsigned long long; int main(){ int n; cin >> n; vector<pair<int, int>> xy(n); rep(i, n) cin >> xy[i].first >> xy[i].second; int ans = 2; rep(i, n-1){ for(int j=i+1; j<n; j++){ int dx = xy[i].first-xy[j].first; int dy = xy[i].second-xy[j].second; int cnt = 0; rep(k, n){ int dx2 = xy[i].first - xy[k].first; int dy2 = xy[i].second - xy[k].second; if(dy*dx2 == dy2*dx) cnt++; } ans = max(ans, cnt); } } cout << ans << endl; return 0; }