結果
問題 | No.1041 直線大学 |
ユーザー |
![]() |
提出日時 | 2023-08-26 18:18:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 724 bytes |
コンパイル時間 | 1,363 ms |
コンパイル使用メモリ | 106,096 KB |
最終ジャッジ日時 | 2025-02-16 14:45:53 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include<iostream>#include<map>#include<vector>#include <algorithm>#include<math.h>#include <iomanip>#include<set>#include <numeric>using namespace std;int main(){int n, cnt = 2, max1 = -1;cin >> n;vector<vector<int>> v(n, vector<int>(2));for (int i = 0; i < n; i++) cin >> v[i][0] >> v[i][1];for (int i = 0; i < n-2; i++){for (int j = i+1; j < n-1; j++){int xp = v[j][0] - v[i][0], yp = v[j][1] - v[i][1];for (int k = j+1; k < n; k++){if (xp*(v[k][1] - v[i][1]) == yp*(v[k][0]-v[i][0])) cnt++;}max1 = max(max1, cnt);cnt = 2;}}if (n == 2) max1 = 2;cout << max1 << endl;}