Submission #875198

# Submission time Handle Problem Language Result Execution time Memory
875198 2023-11-18T18:58:07 Z MinaRagy06 Nicelines (RMI20_nicelines) C++17
11 / 100
2 ms 600 KB
#include <bits/stdc++.h>
#include "nice_lines.h"
#ifdef MINA
#include "grader.cpp"
#endif
using namespace std;
#define ll long long
#define ld long double

void solve(int S, int N) {
	int l = -10'000, r = 10'000;
	while (r - l > 3) {
		int md1 = l + (r - l + 1) / 3, md2 = r - (r - l + 1) / 3;
		if (query(0, md1) <= query(0, md2)) {
			r = md2;
		} else {
			l = md1;
		}
	}
	int b = 0;
	for (int i = l; i <= r; i++) {
		if (query(0, i) == 0) {
			b = i;
			break;
		}
	}
	mt19937 rng(time(0));
	int y = rng() % (20'001) - 10'000;
	double s = -10'000, e = 10'000;
	for (int _ = 0; _ < 100; _++) {
		double md1 = s + (e - s) / 3, md2 = e - (e - s) / 3;
		if (query(md1, y) <= query(md2, y)) {
			e = md2;
		} else {
			s = md1;
		}
	}
	int a = round((y - b) / s);
	the_lines_are({a}, {b});
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 440 KB Output is correct
2 Correct 2 ms 440 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 2 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 444 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 436 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 436 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 600 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 436 KB Incorrect
2 Halted 0 ms 0 KB -