mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-07-18 05:45:46 +00:00
Docs: Update benchmark for x-ai/grok-4.5
This commit is contained in:
22
tests/2_convex_hull/outputs/x-ai_grok-4.5.js
Normal file
22
tests/2_convex_hull/outputs/x-ai_grok-4.5.js
Normal file
@@ -0,0 +1,22 @@
|
||||
async function findConvexHull(points){
|
||||
const{sortBy,uniqWith}=await import("https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/+esm");
|
||||
points=uniqWith(points,(a,b)=>a.x===b.x&&a.y===b.y);
|
||||
points=sortBy(points,["x","y"]);
|
||||
if(points.length<=2)return points;
|
||||
const cross=(o,a,b)=>(a.x-o.x)*(b.y-o.y)-(a.y-o.y)*(b.x-o.x);
|
||||
let lower=[];
|
||||
for(const p of points){
|
||||
while(lower.length>=2&&cross(lower.at(-2),lower.at(-1),p)<=0)lower.pop();
|
||||
lower.push(p);
|
||||
}
|
||||
let upper=[];
|
||||
for(let i=points.length-1;i>=0;i--){
|
||||
const p=points[i];
|
||||
while(upper.length>=2&&cross(upper.at(-2),upper.at(-1),p)<=0)upper.pop();
|
||||
upper.push(p);
|
||||
}
|
||||
return lower.slice(0,-1).concat(upper.slice(0,-1));
|
||||
}
|
||||
export default findConvexHull;
|
||||
// Generation time: 37.988s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user