結果
問題 |
No.1041 直線大学
|
ユーザー |
![]() |
提出日時 | 2020-06-22 16:02:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 868 bytes |
コンパイル時間 | 1,594 ms |
コンパイル使用メモリ | 170,256 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 08:05:18 |
合計ジャッジ時間 | 2,439 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
//c++ テンプレ #include<bits/stdc++.h> using namespace std; typedef long long llint; typedef long double ld; #define inf 1e18 #define mod 1000000007 priority_queue<llint,vector<llint>,greater<llint> > que; priority_queue<llint> Que; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } void solve(){ int n; cin >> n; vector<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 dy=y[j]-y[i]; int dx=x[j]-x[i]; int cnt=2; for(int k=0;k<n;k++){ if(k==i || k==j)continue; if(dx*(y[k]-y[i])==dy*(x[k]-x[i]))cnt++; } ans=max(ans,cnt); } } cout << ans << endl; } int main(){ solve(); return 0; }