結果
| 問題 |
No.245 貫け!
|
| コンテスト | |
| ユーザー |
koyopro
|
| 提出日時 | 2020-01-02 22:01:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,661 bytes |
| コンパイル時間 | 2,289 ms |
| コンパイル使用メモリ | 162,120 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-22 18:21:45 |
| 合計ジャッジ時間 | 2,876 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 9 WA * 7 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define array2(type, x, y) array<array<type, y>, x>
#define vector2(type) vector<vector<type> >
#define out(...) printf(__VA_ARGS__)
int dxy[] = {0, 1, 0, -1, 0};
/*================================*/
int N,M,L;
struct Pos {
int x, y;
};
signed main()
{
#if DEBUG
std::ifstream in("input.txt");
std::cin.rdbuf(in.rdbuf());
#endif
cin>>N;
vector<pair<Pos, Pos>> L(N);
REP(i,N) {
cin >> L[i].first.x >> L[i].first.y >> L[i].second.x >> L[i].second.y;
}
int ans = 0;
REP(i,2*N) REP(j,2*N){
if (i==j) continue;
auto p1 = (i%2) ? L[i/2].first : L[i/2].second;
auto p2 = (j%2) ? L[j/2].first : L[j/2].second;
int a = p1.x - p2.x;
int b = p1.y - p2.y;
/*
tc=(x1-x2)*(y3-y1)+(y1-y2)*(x1-x3)
td=(x1-x2)*(y4-y1)+(y1-y2)*(x1-x4)
tc*td<=0
*/
int cnt = 0;
for (auto l : L) {
auto p3 = l.first;
auto p4 = l.second;
int tc = a * (p3.y - p1.y) + b * (p1.x - p3.x);
int td = a * (p4.y - p1.y) + b * (p1.x - p4.x);
if (tc * td <= 0) cnt++;
}
ans = max(ans, cnt);
}
cout << ans << endl;
return 0;
}
koyopro