結果
| 問題 | No.245 貫け! |
| コンテスト | |
| ユーザー |
tubo28
|
| 提出日時 | 2015-07-14 18:42:03 |
| 言語 | C++11(廃止可能性あり) (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 5,000 ms |
| コード長 | 1,122 bytes |
| 記録 | |
| コンパイル時間 | 469 ms |
| コンパイル使用メモリ | 63,068 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-08 07:14:48 |
| 合計ジャッジ時間 | 1,384 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
ソースコード
#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define PCR Point const&
#define X first
#define Y second
#define EPS (1e-10)
typedef long double Real;
typedef pair<Real,Real> Point;
Point operator - (PCR a, PCR b){
return Point(a.X-b.X, a.Y-b.Y);
}
Real dot(PCR a, PCR b){
return a.X * b.X + a.Y*b.Y;
}
Real cross(PCR a, PCR b){
return a.X*b.Y - a.Y*b.X;
}
Real norm(PCR a){
return a.X*a.X + a.Y*a.Y;
}
bool operator == (PCR a, PCR b){
return norm(a-b) < EPS;
}
bool intersect(PCR l0, PCR l1, PCR s0, PCR s1){
return cross(l1-l0, s0-l0)*cross(l1-l0, s1-l0) < EPS;
}
int main(){
int n;
cin >> n;
Point p[110], q[110];
Point r[220];
rep(i,n){
cin >> p[i].X >> p[i].Y >> q[i].X >> q[i].Y;
r[i*2] = p[i], r[i*2+1] = q[i];
}
sort(r,r+n*2);
int m = unique(r,r+n*2) - r;
int ans = -1;
rep(i,m)rep(j,i){
int cnt = 0;
rep(k,n){
if(intersect(r[i],r[j],p[k],q[k])) cnt++;
}
ans = max(ans,cnt);
}
cout << ans << endl;
}
tubo28