結果
| 問題 |
No.245 貫け!
|
| コンテスト | |
| ユーザー |
Tawara
|
| 提出日時 | 2015-07-19 02:01:03 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,373 bytes |
| コンパイル時間 | 639 ms |
| コンパイル使用メモリ | 78,180 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-08 10:16:13 |
| 合計ジャッジ時間 | 1,401 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 8 WA * 8 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef vector <int> VI;
typedef vector <VI> VVI;
typedef vector <string> VS;
typedef pair<int,int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int, LL> PIL;
typedef vector <PII>VPII;
typedef vector <PIL> VPIL;
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define sort(c) sort((c).begin(),(c).end())
#define range(i,a,b) for(int i=(a); i < (b); i++)
#define rep(i,n) range(i,0,n)
#define MAX_INT 2147483647
int cross_prod(PII a, PII b, PII pi){
return ( (b.first - a.first) * (b.second - pi.second)
- (b.second - a.second) * (a.first - pi.first) );
}
int count(PII a, PII b, VPII ep1, VPII ep2, int N){
int num = 0;
rep(i,N){
if (cross_prod(a,b,ep1[i]) * cross_prod(a,b,ep2[i]) <= 0)
num += 1;
}
return num;
}
int main(){
int N, max_num = 1;
VPII ep1, ep2, p;
cin >> N;
ep1.resize(N); ep2.resize(N);
rep(i,N){
cin >> ep1[i].first >> ep1[i].second >> ep2[i].first >> ep2[i].second;
p.push_back(ep1[i]);
p.push_back(ep2[i]);
}
rep(i,2*N-1)
range(j,i+1,2*N){
if (p[i] != p[j])
max_num = max(max_num, count(p[i],p[j],ep1,ep2, N));
}
cout << max_num << endl;
return 0;
}
Tawara