結果

問題 No.245 貫け!
ユーザー okaduki
提出日時 2015-07-18 00:35:42
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 9 ms / 5,000 ms
コード長 2,109 bytes
コンパイル時間 722 ms
コンパイル使用メモリ 94,464 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-08 09:52:59
合計ジャッジ時間 1,390 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
int cross(PII p, PII q){
return p.first*q.second - p.second*q.first;
}
bool f(PII a, PII b, PII c, PII d){
PII dd = b;
dd.first -= a.first, dd.second -= a.second;
c.first -= a.first, c.second -= a.second;
d.first -= a.first, d.second -= a.second;
return cross(dd,c) * cross(dd,d) <= 0;
}
int main(){
cin.tie(0);
ios_base::sync_with_stdio(false);
int N; cin >> N;
vector<PII> as(N), bs(N), al(N*2);
REP(i,N){
cin >> as[i].first >> as[i].second >> bs[i].first >> bs[i].second;
al[i*2] = as[i], al[i*2+1] = bs[i];
}
SORT(al);
al.erase(unique(al.begin(), al.end()), al.end());
int ans = 0;
REP(i,SZ(al)) REP(j,SZ(al)){
if(i == j) continue;
int sum = 0;
REP(k,N) if(f(al[i], al[j], as[k], bs[k])) ++sum;
ans = max(sum, ans);
}
cout << ans << endl;
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0