結果
問題 |
No.245 貫け!
|
ユーザー |
![]() |
提出日時 | 2015-07-17 23:30:01 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,276 bytes |
コンパイル時間 | 766 ms |
コンパイル使用メモリ | 89,936 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-08 09:36:53 |
合計ジャッジ時間 | 1,650 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 WA * 4 |
ソースコード
#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); double cross(double y, double x, double y_, double 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 = 0; for(int i=0; i<n; i++){ for(int k=0; k<2; k++){ set<pair<double,int>> s; 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)]); double 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){ r += 2*PI; } s.insert({l,j}); s.insert({r, j+n}); s.insert({l+2*PI,j}); s.insert({r+2*PI, j+n}); } set<int> z; 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; }