Submission #828496

# Submission time Handle Problem Language Result Execution time Memory
828496 2023-08-17T10:30:46 Z rainboy Nicelines (RMI20_nicelines) C
0 / 100
126 ms 1052 KB
#include "nice_lines_c.h"
 
#define N	100
#define M	10000
#define X	1000000
#define Y	((long long) M * X + M + 1)
 
typedef long double ld;
 
int aa[N], bb[N], n;

void solve_(ld ul, ld vl, ld ur, ld vr) {
	ld z1, z2, u, v; 
	long long y, a, b;

	y = (vr - vl) / (ul - ur) + 0.5;
	z1 = query(X, y), z2 = query(X, y + 1);
	u = z2 - z1, v = z1 - u * y;
	if (u == ul && v == vl || u == ur && v == vr) {
		a = y / X, b = y - a * X;
		while (b < -M)
			a--, b += X;
		while (b > M)
			a++, b -= X;
		aa[n] = a, bb[n] = b, n++;
		return;
	}
	solve_(ul, vl, u, v), solve_(u, v, ur, vr);
}

void solve(int subtask_id, int n_) {
	ld ul, vl, ur, vr, z1, z2;

	z1 = query(X, -Y - 1), z2 = query(X, -Y);
	ul = z2 - z1, vl = z2 - ul * -Y;
	z1 = query(X, Y), z2 = query(X, Y + 1);
	ur = z2 - z1, vr = z1 - ur * Y;
	n = 0, solve_(ul, vl, ur, vr);
	the_lines_are(aa, bb);
}

Compilation message

nicelines.c: In function 'solve_':
nicelines.c:19:14: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   19 |  if (u == ul && v == vl || u == ur && v == vr) {
      |      ~~~~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Incorrect 94 ms 1020 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong query
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 126 ms 1052 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Wrong query
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Wrong query
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Wrong query
2 Halted 0 ms 0 KB -