結果
問題 | No.1041 直線大学 |
ユーザー |
|
提出日時 | 2020-05-01 21:37:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 850 bytes |
コンパイル時間 | 1,467 ms |
コンパイル使用メモリ | 166,424 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 07:50:11 |
合計ジャッジ時間 | 2,533 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define int long longtemplate<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }signed main(){int n;cin >> n;int x[110], y[110];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 = 0;j < n;j++){if(i == j) continue;int cnt = 2;int a = x[i] - x[j];int b = y[i] - y[j];for(int k = 0;k < n;k++){if(k == i || k == j) continue;int c = x[i] - x[k];int d = y[i] - y[k];if(a == 0){if(c == 0) cnt++;}else if(b == 0){if(d == 0) cnt++;}else{if(a*d == c*b){cnt++;}}}chmax(ans, cnt);}}cout << ans << endl;return 0;}