1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
ZnVuY3Rpb24gc3RyMmJpbmwoZCkgewogICAgZm9yICh2YXIgXyA9IEFycmF5KCksIG0gPSAoMSA8PCA4KSAtIDEsIHIgPSAwOyByIDwgZC5sZW5ndGggKiA4OyByICs9IDgpCiAgICAgICAgX1tyID4+IDVdIHw9IChkLmNoYXJDb2RlQXQociAvIDgpICYgbSkgPDwgciAlIDMyOwogICAgcmV0dXJuIF8KfQoKZnVuY3Rpb24gYmlubDJoZXgoZCkgewogICAgZm9yICh2YXIgXyA9IDAgPyAiMDEyMzQ1Njc4OUFCQ0RFRiIgOiAiMDEyMzQ1Njc4OWFiY2RlZiIsIG0gPSAiIiwgciA9IDA7IHIgPCA0ICogZC5sZW5ndGg7IHIrKykKICAgICAgICBtICs9IF8uY2hhckF0KGRbciA+PiAyXSA+PiByICUgNCAqIDggKyA0ICYgMTUpICsgXy5jaGFyQXQoZFtyID4+IDJdID4+IHIgJSA0ICogOCAmIDE1KTsKICAgIHJldHVybiBtCn0KCmZ1bmN0aW9uIGNvcmVfbWQ1KGQsIF8pIHsKICAgIGRbXyA+PiA1XSB8PSAxMjggPDwgXyAlIDMyLAogICAgICAgIGRbMTQgKyAoXyArIDY0ID4+PiA5IDw8IDQpXSA9IF87CiAgICBmb3IgKHZhciBtID0gMTczMjU4NDE5MywgciA9IC0yNzE3MzM4NzksIG4gPSAtMTczMjU4NDE5NCwgaCA9IDI3MTczMzg3OCwgZiA9IDA7IGYgPCBkLmxlbmd0aDsgZiArPSAxNikgewogICAgICAgIHZhciBpID0gbQogICAgICAgICAgICAsIHQgPSByCiAgICAgICAgICAgICwgYyA9IG4KICAgICAgICAgICAgLCBlID0gaDsKICAgICAgICBtID0gbWQ1X2ZmKG0sIHIsIG4sIGgsIGRbZiArIDBdLCA3LCAtNjgwODc2OTM2KSwKICAgICAgICAgICAgaCA9IG1kNV9mZihoLCBtLCByLCBuLCBkW2YgKyAxXSwgMTIsIC0zODk1NjQ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1ZSwKICAgIGxhenk6ICRqcy50b1N0cmluZygoKSA9PiB7CiAgICAgICAgbGV0IFQgPSBpbnB1dC5zcGxpdCgnLycpWzRdOwogICAgICAgIGxldCBVID0gJ0ZSRFNIRlNLVktTS0ZLUyc7CiAgICAgICAgbGV0IGIgPSBpbnB1dC5zcGxpdCgnLycpWzVdOwogICAgICAgIGxldCBkYXRhID0gewogICAgICAgICAgICBjb2RlOiBULAogICAgICAgICAgICBubzogYiwKICAgICAgICAgICAgdHlwZTogMCwKICAgICAgICAgICAgdGltZXN0YW1wOiAobmV3IERhdGUpLmdldFRpbWUoKSwKICAgICAgICAgICAgc2lnbjogaGV4X21kNSgobmV3IERhdGUpLmdldFRpbWUoKSArIFQgKyBiICsgVSkKICAgICAgICB9OwogICAgICAgIGxldCBodG1sID0gcmVxdWVzdCgnaHR0cDovL3d3dy42eXVldGluZy5jb20vd2ViL2luZGV4L3ZpZGVvX25ldz9jb2RlPScgKyBkYXRhLmNvZGUgKyAnJm5vPScgKyBkYXRhLm5vICsgJyZ0eXBlPScgKyBkYXRhLnR5cGUgKyAnJnRpbWVzdGFtcD0nICsgZGF0YS50aW1lc3RhbXAgKyAnJnNpZ249JyArIGRhdGEuc2lnbik7CiAgICAgICAgbGV0IHVybCA9IHVuZXNjYXBlKEpTT04ucGFyc2UoaHRtbCkuZGF0YS52aWRlb1VybCk7CiAgICAgICAgaW5wdXQgPSB7cGFyc2U6IDAsIHVybDogdXJsLCBoZWFkZXI6IHJ1bGUuaGVhZGVyc307CiAgICB9KSwKICAgIGxpbWl0OiA2LAogICAg5Zu+54mH5p2l5rqQOiAnQFJlZmVyZXI9aHR0cDovL20uNnl1ZXRpbmcuY29tL0BVc2VyLUFnZW50PU1PQklMRV9VQScsCiAgICDmjqjojZA6ICcqJywKICAgIOS4gOe6pzogJy5saXN0LXdyYXBwZXImJi5pdGVtLWxpbms7aDItLXNwYW4mJlRleHQ7aW1nJiZzcmM7LnN0YXR1cyYmVGV4dDthJiZocmVm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