結果
| 問題 | 
                            No.245 貫け!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             koyumeishi
                         | 
                    
| 提出日時 | 2015-07-17 23:39:22 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,413 bytes | 
| コンパイル時間 | 672 ms | 
| コンパイル使用メモリ | 89,552 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-08 09:39:34 | 
| 合計ジャッジ時間 | 1,459 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 13 WA * 3 | 
ソースコード
#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <set>
using namespace std;
constexpr double PI = acos(-1);
long long cross(long long y, long long x, long long y_, long long x_){
	return x*y_ - y*x_;
}
int main(){
	int n;
	cin >> n;
	vector<int> x(2*n), y(2*n);
	for(int i=0; i<n; i++){
		cin >> x[i] >> y[i] >> x[i+n] >> y[i+n];
	}
	int ans = 1;
	for(int i=0; i<n; i++){
		for(int k=0; k<2; k++){
			set<pair<double,int>> s;
			set<int> z;
			for(int j=0; j<n; j++){
				if(i==j) continue;
				double l = atan2(y[j] - y[i+(k?n:0)], x[j] - x[i+(k?n:0)]);
				double r = atan2(y[j+n] - y[i+(k?n:0)], x[j+n] - x[i+(k?n:0)]);
				long long c = cross( y[j] - y[i+(k?n:0)], x[j] - x[i+(k?n:0)], y[j+n] - y[i+(k?n:0)], x[j+n] - x[i+(k?n:0)] );
				if(c < 0){
					swap(l,r);
				}
				if(l - r > 1e-9 ){
					r += 2*PI;
				}
				if(c==0 && fabs(PI - fabs(l-r)) < 1e-6){
					z.insert(j);
				}else{
					s.insert({l-1e-9,j});
					s.insert({r+1e-9, j+n});
					s.insert({l-1e-9+2*PI,j});
					s.insert({r+1e-9+2*PI, j+n});
				}
			}
			for(auto itr = s.begin(); itr != s.end(); itr++){
				if((*itr).second < n){
					z.insert((*itr).second);
				}else{
					z.erase((*itr).second - n);
				}
				ans = max(ans, (int)z.size() + 1);
			}
		}
	}
	cout << ans << endl;
	return 0;
}
            
            
            
        
            
koyumeishi