結果
問題 | No.1041 直線大学 |
ユーザー | IKyopro |
提出日時 | 2020-05-01 22:01:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 676 bytes |
コンパイル時間 | 2,037 ms |
コンパイル使用メモリ | 193,436 KB |
最終ジャッジ日時 | 2025-01-10 04:49:21 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T, class U> using Pa = pair<T, U>; template <class T> using vec = vector<T>; template <class T> using vvec = vector<vec<T>>; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vec<int> X(N),Y(N); for(int i=0;i<N;i++){ cin >> X[i] >> Y[i]; } int ans = 0; for(int i=0;i<N;i++) for(int j=i+1;j<N;j++){ int dx = X[i]-X[j],dy = Y[i]-Y[j]; int a = dy,b = -dx,c = -X[i]*dy+dx*Y[i]; int cnt = 0; for(int k=0;k<N;k++) cnt += a*X[k]+b*Y[k]+c==0; ans = max(ans,cnt); } cout << ans << "\n"; }