QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#179995 | #7242. Mr.~Credo | mendicillin2# | WA | 0ms | 3828kb | C++17 | 2.0kb | 2023-09-15 14:20:15 | 2023-09-15 14:20:15 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
template <class T> int sz(T&& a) { return int(size(forward<T>(a))); }
template <class T> using vc = vector<T>;
template <class T> using vvc = vc<vc<T>>;
using ll = int64_t;
using vi = vc<int>;
template <class F>
struct ycr {
F f;
template <class T>
explicit ycr(T&& f_) : f(forward<T>(f_)) {}
template <class... Args>
decltype(auto) operator()(Args&&... args) {
return f(ref(*this), forward<Args>(args)...);
}
};
template <class F>
decltype(auto) yc(F&& f) {
return ycr<decay_t<F>>(forward<F>(f));
}
int main() {
ios_base::sync_with_stdio(false), cin.tie(nullptr);
cout << fixed << setprecision(20);
int N; cin >> N;
const int A = 1296000;
auto norm = [&](int a) -> int {
return a % A;
};
vector<int> S(N), T(N);
vector<int> angles = {0, A};
for (int i = 0; i < N; i++) {
{
int x, y; cin >> x >> y;
}
int s, t; cin >> s >> t;
s += t;
swap(s, t);
//cerr << "[" << s << ", " << t << "]" << endl;
S[i] = s, T[i] = t;
angles.push_back(norm(s));
angles.push_back(norm(t));
}
sort(angles.begin(), angles.end());
angles.erase(unique(angles.begin(), angles.end()), angles.end());
const int M = int(angles.size());
vector<int> diffs(M);
auto add = yc([&](auto self, int s, int t) -> void {
if (s == t) return;
if (s < t) {
s = int(lower_bound(angles.begin(), angles.end(), s) - angles.begin());
t = int(lower_bound(angles.begin(), angles.end(), t) - angles.begin());
diffs[s]++;
diffs[t]--;
//cerr << "[" << s << ", " << t << ")" << endl;
} else {
t = norm(t);
self(0, t);
self(s, A);
};
});
for (int i = 0; i < N; i++) {
add(S[i], T[i]);
}
int cur = 0;
for (int l = 0; l < M; l++) {
cur += diffs[l];
if (cur == 0) {
assert(l+1 < M);
int st = angles[l];
int en = angles[l+1];
double real_ang = 2 * M_PI * (double(st + en) / 2) / A;
int x = int(1e9 * cos(real_ang));
int y = int(1e9 * sin(real_ang));
cout << "YES" << '\n';
cout << x << ' ' << y << '\n';
exit(0);
}
}
assert(false);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3796kb
input:
4 1 2 486000 0 -1 1 324000 648000 1 0 108000 0 1 0 108000 1188000
output:
YES -923879532 382683432
result:
ok Seems ok, min distance to light = 3.82683e+08
Test #2:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
10 0 0 149605 640182 0 0 51924 760110 0 0 14531 370974 0 0 82864 1009818 0 0 13668 877773 0 0 27523 945102 0 0 216723 246382 0 0 268334 861058 0 0 142890 328031 0 0 223562 461949
output:
YES 826887046 562368040
result:
ok Seems ok, min distance to light = 5.62368e+08
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3828kb
input:
10 32 -15 514796 11109 30 -12 181791 391320 -43 31 21111 151392 -43 -41 47933 1199789 48 37 57302 1953 6 -15 91381 1253012 -12 10 83332 988560 -35 3 144973 329169 -25 47 23208 576618 12 6 119845 830237
output:
YES 999988793 4734187
result:
wrong answer The circle is partially or fully lit by a 5-th spotlight