diff --git a/khj20006/202510/30 BOJ P5 Pineapple Pizza.md b/khj20006/202510/30 BOJ P5 Pineapple Pizza.md new file mode 100644 index 00000000..b61029e3 --- /dev/null +++ b/khj20006/202510/30 BOJ P5 Pineapple Pizza.md @@ -0,0 +1,70 @@ +```cpp +#include +using namespace std; + +vector> p, u, l; +int N, K; + +int ccw(pair a, pair b, pair c) { + auto [ax, ay] = a; + auto [bx, by] = b; + auto [cx, cy] = c; + long long res = ax*by + bx*cy + cx*ay - (ax*cy + bx*ay + cx*by); + if(res > 0) return 1; + if(res < 0) return -1; + return 0; +} + +int main() { + cin.tie(0)->sync_with_stdio(0); + + cin>>N>>K; + if(N%K) return cout<<"NO",0; + p.resize(N); + for(auto &[x,y]:p) cin>>x>>y; + int _x, _y; + cin>>_x>>_y; + for(auto &[x,y]:p) { + x-=_x, y-=_y; + if(y < 0 || (y == 0 && x < 0)) l.emplace_back(x,y); + else u.emplace_back(x,y); + } + + sort(u.begin(), u.end(), [](auto a, auto b) -> bool { + return ccw({0,0}, a, b) < 0; + }); + sort(l.begin(), l.end(), [](auto a, auto b) -> bool { + return ccw({0,0}, a, b) < 0; + }); + + deque a; + for(int i=1;i N/K) { + poss = 0; + break; + } + } + if(poss) return cout<<"YES", 0; + } + cout<<"NO"; + +} +```