mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-04-27 19:52:14 +00:00
Docs: Update benchmark for deepseek/deepseek-v4-pro
This commit is contained in:
25
tests/2_convex_hull/outputs/deepseek_deepseek-v4-pro.js
Normal file
25
tests/2_convex_hull/outputs/deepseek_deepseek-v4-pro.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const findConvexHull = async (points) => {
|
||||
const _ = await import('https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js');
|
||||
const pts = _.sortBy(_.uniqWith(points, (a, b) => a.x === b.x && a.y === b.y), ['x', 'y']);
|
||||
const n = pts.length;
|
||||
if (n <= 2) return pts;
|
||||
const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
|
||||
const lower = [];
|
||||
for (let i = 0; i < n; i++) {
|
||||
while (lower.length >= 2 && cross(lower[lower.length - 2], lower[lower.length - 1], pts[i]) <= 0)
|
||||
lower.pop();
|
||||
lower.push(pts[i]);
|
||||
}
|
||||
const upper = [];
|
||||
for (let i = n - 1; i >= 0; i--) {
|
||||
while (upper.length >= 2 && cross(upper[upper.length - 2], upper[upper.length - 1], pts[i]) <= 0)
|
||||
upper.pop();
|
||||
upper.push(pts[i]);
|
||||
}
|
||||
lower.pop();
|
||||
upper.pop();
|
||||
return lower.concat(upper);
|
||||
};
|
||||
export default findConvexHull;
|
||||
// Generation time: 21.237s
|
||||
// Result: FAIL
|
||||
Reference in New Issue
Block a user