# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
159473 |
2019-10-22T21:30:30 Z |
exqt |
Jogging (kriii1_J) |
C++11 |
|
96 ms |
7024 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct Pt {
int x, y;
Pt() {}
Pt(int x, int y) : x(x), y(y) {}
bool operator<(const Pt &o) const {
return x < o.x;
}
double look_from(int p) {
return atan2(y, x-p);
}
};
ll ccw(Pt a, Pt b, Pt c) {
int abx = b.x - a.x;
int aby = b.y - a.y;
int bcx = c.x - b.x;
int bcy = c.y - b.y;
return 1LL*abx*bcy - 1LL*aby*bcx;
}
int main () {
#ifdef LOCAL
freopen("in.txt", "r", stdin);
#endif
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m; cin >> n >> m;
vector<Pt> pts(n);
for(int i=0; i<n; i++) cin >> pts[i].x >> pts[i].y;
vector<int> p(m);
vector<double> res(m);
for(int i=0; i<m; i++) cin >> p[i];
sort(pts.begin(), pts.end());
vector<Pt> st;
auto upd = [&](int px) {
while(st.size() >= 2 && ccw(Pt(px, 0), st.back(), st[(int)st.size()-2]) >= 0) {
st.pop_back();
}
};
for(int i=m-1; i>=0; i--) {
while(pts.size() && p[i] < pts.back().x) {
while(st.size() && pts.back().y > st.back().y) {
st.pop_back();
}
st.push_back(pts.back());
pts.pop_back();
upd(st.back().x);
}
upd(p[i]);
res[i] = st.size() ? st.back().look_from(p[i]) : 0.0;
}
cout << fixed;
cout.precision(7);
for(int i=0; i<m; i++) {
cout << res[i] << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
96 ms |
7024 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |