結果
| 問題 |
No.245 貫け!
|
| コンテスト | |
| ユーザー |
vain0
|
| 提出日時 | 2015-07-18 00:18:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,192 bytes |
| コンパイル時間 | 576 ms |
| コンパイル使用メモリ | 83,016 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-08 09:50:32 |
| 合計ジャッジ時間 | 1,475 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 6 WA * 10 |
ソースコード
#include <cassert>
#include <functional>
#include <set>
#include <ctime>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#ifndef ONLINE_JUDGE //POJ
# include <complex>
# include <random>
# include <array>
# define mkt make_tuple
# define empb emplace_back
#endif
#ifdef _LOCAL
# include "for_local.h"
#else
# define debug if (false)
#endif
using namespace std;
typedef unsigned int uint; typedef long long ll; typedef unsigned long long ull;
#define repi(_I, _B, _E) for(int _I = (_B); (_I) < (_E); ++ (_I))
#define rep(_I, _N) for(int _I = 0; (_I) < (_N); ++ (_I))
#define mkp make_pair
#define all(_X) (_X).begin(), (_X).end()
struct Point
{
int x, y;
};
vector<Point> as, cs;
int n;
bool intersect(Point& p1, Point& p2, Point& q1, Point& q2)
{
if ( p1.x >= p2.x ) {
if ( (p1.x < q1.x && p1.x < q2.x) || (p2.x > q1.x && p2.x > q2.x) ) {
return false;
}
} else {
if ( (p2.x < q1.x && p2.x < q2.x) || (p1.x > q1.x && p1.x > q2.x) ) {
return false;
}
}
if ( p1.y >= p2.y ) {
if ( (p1.y < q1.y && p1.y < q2.y) || (p2.y > q1.y && p2.y > q2.y) ) {
return false;
}
} else {
if ( (p2.y < q1.y && p2.y < q2.y) || (p1.y > q1.y && p1.y > q2.y) ) {
return false;
}
}
if ( ((p1.x - p2.x) * (q1.y - p1.y) + (p1.y - p2.y) * (p1.x - q1.x)) * ((p1.x - p2.x) * (q2.y - p1.y) + (p1.y - p2.y) * (p1.x - q2.x)) > 0 ) {
return false;
}
if ( ((q1.x - q2.x) * (p1.y - q1.y) + (q1.y - q2.y) * (q1.x - p1.x)) * ((q1.x - q2.x) * (p2.y - q1.y) + (q1.y - q2.y) * (q1.x - p2.x)) > 0 ) {
return false;
}
return true;
}
signed main()
{
cin >> n;
as.resize(n);
cs.resize(n);
rep(i, n)
{
cin >> as[i].x >> as[i].y >> cs[i].x >> cs[i].y;
}
int m = 0;
rep(i1, n)
{
repi(i2, i1 + 1, n)
{
rep(b1, 2)
{
rep(b2, 2)
{
auto& q1 = (b1 ? as[i1] : cs[i1]);
auto& q2 = (b2 ? as[i2] : cs[i2]);
int cnt = 2;
rep(i, n)
{
if ( i == i1 || i == i2 ) continue;
if ( intersect(as[i], cs[i], q1, q2) ) { cnt++; }
}
m = max(m, cnt);
}
}
}
}
cout << m << endl;
return 0;
}
vain0