제출 #1079074

#제출 시각아이디문제언어결과실행 시간메모리
1079074antonTiles (BOI24_tiles)C++17
0 / 100
107 ms15524 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define pt complex<int> #define pii pair<int, int> int N, M; vector<pt> points; int cross(pt a, pt b){ return (a * conj(b)).imag(); } struct Edge{ pt a, b; pt d(){ return b-a; } }; signed main(){ cin>>N>>M; for(int i = 0; i<N; i++){ int a, b; cin>>a>>b; points.push_back({a, b}); } vector<Edge> edges; pt prev_pt= points.back(); for(int i = 0; i<N; i++){ pt edge = points[i]-prev_pt; if(edges.size()>0 && cross(edges.back().d(), edge) == 0){ edges.back().b= points[i]; } else{ edges.push_back(Edge{prev_pt, points[i]}); } prev_pt= points[i]; } while(cross(edges.back().d(), edges[0].d()) == 0){ edges[0].a = edges.back().a; edges.pop_back(); } int k = M; for(auto edge: edges){ if(edge.d().imag() == 0){ if((edge.d().real()%2) ==1){ k = min(k, max(edge.a.real()-edge.a.real()%2, edge.b.real()-edge.b.real()%2)); } } } cout<<k<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...