結果

問題 No.245 貫け!
ユーザー okadukiokaduki
提出日時 2015-07-18 00:39:24
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,386 bytes
コンパイル時間 721 ms
コンパイル使用メモリ 90,524 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-22 18:41:44
合計ジャッジ時間 1,738 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 11 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 11 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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);
  REP(i,N)
    cin >> as[i].first >> as[i].second >> bs[i].first >> bs[i].second;

  int ans = 0;
  REP(i,N) REP(j,N){
    int sum = 0;
    REP(k,N) if(f(as[i], bs[j], as[k], bs[k])) ++sum;
    ans = max(sum, ans);
  }
  REP(i,N) REP(j,N){
    int sum = 0;
    REP(k,N) if(f(bs[i], as[j], as[k], bs[k])) ++sum;
    ans = max(sum, ans);
  }
  REP(i,N) REP(j,N){
    if(i == j) continue;
    int sum = 0;
    REP(k,N) if(f(as[i], as[j], as[k], bs[k])) ++sum;
    ans = max(sum, ans);
  }
  REP(i,N) REP(j,N){
    if(i == j) continue;
    int sum = 0;
    REP(k,N) if(f(bs[i], bs[j], as[k], bs[k])) ++sum;
    ans = max(sum, ans);
  }
  cout << ans << endl;
  
  return 0;
}
0