結果
問題 | No.1041 直線大学 |
ユーザー |
![]() |
提出日時 | 2020-05-01 21:35:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 693 bytes |
コンパイル時間 | 1,937 ms |
コンパイル使用メモリ | 169,184 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 07:49:47 |
合計ジャッジ時間 | 3,083 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include <bits/stdc++.h>using namespace std;struct point{int x;int y;point(){}point (int a, int b){x = a;y = b;}point operator -(point P){return point(x - P.x, y - P.y);}};long long cross(point P, point Q){return P.x * Q.y - P.y * Q.x;}int main(){int N;cin >> N;vector<point> P(N);for (int i = 0; i < N; i++){cin >> P[i].x >> P[i].y;}int ans = 0;for (int i = 0; i < N; i++){for (int j = i + 1; j < N; j++){int count = 0;for (int k = 0; k < N; k++){if (cross(P[j] - P[i], P[k] - P[i]) == 0){count++;}}ans = max(ans, count);}}cout << ans << endl;}