Submission #944579

# Submission time Handle Problem Language Result Execution time Memory
944579 2024-03-13T01:10:13 Z daoquanglinh2007 Nicelines (RMI20_nicelines) C++17
0 / 100
34 ms 700 KB
#include <bits/stdc++.h>
#include "nice_lines.h"
using namespace std;

#define ld long double
#define pii pair <int, int>
#define fi first
#define se second
#define mp make_pair
 
const int LIM = 1e4, x0 = LIM, MAX_DEP = 32;
 
const ld EPS = 1e-9, inf = 1e18;
 
vector <int> va, vb;
set <pii> S;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int get_rand(int l, int r){
	int tmp = rng()%(r-l+1);
	if (tmp < 0) tmp += r-l+1;
	return l + tmp;
}
 
void get(ld y){
	int b = int(round(y+x0*LIM+LIM))%x0-LIM, a = int(round(y-b)/(ld)x0);
	if (!S.count(mp(a, b))){
		va.push_back(a);
		vb.push_back(b);
		S.insert(mp(a, b));
	}
}
 
void dnc(int dep, ld l, ld r, ld fl, ld fr){
	if (dep >= MAX_DEP){
		get(l);
		return;
	}
	ld mid = (l+r)/2.0;
	if (fl == +inf) fl = query(x0, l);
	if (fr == +inf) fr = query(x0, r);
	ld fmid = query(x0, mid);
	if (abs(2.0*fmid - (fl+fr)) <= EPS) return;
	dnc(dep+1, l, mid, fl, fmid);
	dnc(dep+1, mid, r, fmid, fr);
}
 
void solve(int subtask_id, int N){
	va.clear();
	vb.clear();
	dnc(0, -2*LIM*(x0+1)-get_rand(0, 100), 2*LIM*(x0+1)+get_rand(0, 100), +inf, +inf);
	the_lines_are(va, vb);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 444 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 456 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 440 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 700 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 448 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 700 KB Incorrect
2 Halted 0 ms 0 KB -