/*! path: /home/ts3min/work/tspro/src/contest/atcoder/msol2020/e.ts */!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";(function(t){var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.main=void 0;const o=r(n(2)),i=n(3);var u;function c(t,e,n){const{cand:r,N:o,C:i,ans:a}=n;if(t!==o)r[t]=u.N,c(t+1,e,n),r[t]=u.X,c(t+1,e+1,n),r[t]=u.Y,c(t+1,e+1,n);else{const t=function({N:t,C:e,cand:n}){let r=0;for(let o=0;o<t;o++){if(n[o]!=u.N)continue;let i=Math.min(Math.abs(e[o].x),Math.abs(e[o].y))*e[o].p;for(let r=0;r<t;r++)n[r]==u.Y?i=Math.min(i,Math.abs(e[o].x-e[r].x)*e[o].p):n[r]==u.X&&(i=Math.min(i,Math.abs(e[o].y-e[r].y)*e[o].p));r+=i}return r}({N:o,C:i,cand:r});a[e]=Math.min(a[e],t)}}function a(t){const e=i.getNextInt(t),n=e(),r=[];for(let t=0;t<n;t++){const t=e(),n=e(),o=e();r.push({x:t,y:n,p:o})}console.log(function({N:t,C:e}){const n=Array(t+1).fill(Number.MAX_SAFE_INTEGER);return c(0,0,{N:t,C:e,ans:n,cand:Array(t)}),n}({N:n,C:r}).join("\n"))}if(function(t){t.X="X",t.Y="Y",t.N="N"}(u||(u={})),e.main=a,n.c[n.s]===t){a(o.default.readFileSync("/dev/stdin","utf8"))}}).call(this,n(1)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=require("fs")},function(t,e,n){"use strict";function*r(t){const e=t.split(/\s+/);for(const t of e)yield t}Object.defineProperty(e,"__esModule",{value:!0}),e.getNextBigInt=e.getNextInt=e.getNext=e.getIteratorWithParser=e.getIterator=void 0,e.getIterator=r,e.getIteratorWithParser=function*(t,e){const n=t.split(/\s+/);for(const t of n)yield e(t)},e.getNext=function(t){const e=r(t);return()=>e.next().value},e.getNextInt=function(t){const e=r(t);return()=>parseInt(e.next().value)},e.getNextBigInt=function(t){const e=r(t);return()=>BigInt(e.next().value)}}]);
//# sourceMappingURL=submit.js.map