QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#180056#7242. Mr.~Credoxaphoenix#WA 2ms9860kbC++141.8kb2023-09-15 15:08:222023-09-15 15:08:23

Judging History

你现在查看的是最新测评结果

  • [2023-09-15 15:08:23]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:9860kb
  • [2023-09-15 15:08:22]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define LC k<<1
#define RC k<<1|1
#define IO cin.sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repn(i, a, n) for (int i = a; i <= n; i++)
#define per(i, a, n) for (int i = (n) - 1; i >= a; i--)
#define pern(i, a, n) for (int i = n; i >= a; i--)

typedef long long LL;
typedef long double LD;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<int, LL> PIL;
typedef pair<LL, int> PLI;
typedef pair<double, double> PDD;
typedef pair<ull, ull> PUU;
typedef pair<LL, LL> PLL;

const int N = 2100000;
const int M = 1100000;
const int mod = 1e9+7;
const int inf = ((int)1e9) - 10;
const LL INF = 1e18;
const double eps = 1e-9;

mt19937_64 Rand((unsigned long long)new char);
#define rand Rand

const int L = 1296000;
const LD pi = acos(-1.0);
int n, f[N];
int main() {
	IO;
	cin >> n;
	repn(i, 1, n) {
		int x, y, d, a;
		cin >> x >> y >> d >> a;
		d--;
		if (a + d >= L) f[a]++, f[0]++, f[a + d - L + 1]--;
		else f[a]++, f[a + d + 1]--;
	}
	int cur = 0, pos;
	rep(i, 0, L) {
		cur += f[i];
		if (cur == 0) {
			pos = i;
			break;
		}
	}
	LD ang = (LD)pos / (L / 2) * pi, dx = cos(ang), dy = sin(ang), r = 1.0, d = 0;
	int ax, ay, cnt = 0;
	while (1) {
		while (dx * (r + d) < -inf + eps || dx * (r + d) > inf - eps || dy * (r + d) < -inf + eps || dy * (r + d) > inf + eps)  {
			cnt++;
			r /= 2.0;
		}
		d += r;
		ax = (int)(dx * d + 0.1);
		ay = (int)(dy * d + 0.1);
		r *= 2;
		if (cnt > 1000) break;
	}
	cout << "YES\n";
	cout << ax << " " << ay << "\n";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 9860kb

input:

4
1 2 486000 0
-1 1 324000 648000
1 0 108000 0
1 0 108000 1188000

output:

YES
-999999989 999999990

result:

ok Seems ok, min distance to light = 1.41421

Test #2:

score: 0
Accepted
time: 0ms
memory: 7828kb

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
999999990 0

result:

ok Seems ok, min distance to light = 7.22726e+08

Test #3:

score: -100
Wrong Answer
time: 2ms
memory: 9736kb

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
-999999989 379914291

result:

wrong answer The circle is partially or fully lit by a 1-th spotlight