mirror of https://git.acwing.com/iduoduo/orange
1 line
2.3 KiB
JavaScript
1 line
2.3 KiB
JavaScript
Z2xvYmFsVGhpcy5nZXRWaWRlb3MgPSBmdW5jdGlvbiAobGluaywga2V5KSB7CiAgICBsZXQgaHRtbCA9IHJlcXVlc3QobGluayk7CiAgICBsZXQganNvbiA9IEpTT04ucGFyc2UoaHRtbCk7CiAgICBsZXQgZGF0YSA9IGpzb24uZGF0YTsKICAgIGRhdGEgPSBkYXRhW2tleV07CiAgICBsZXQgdmlkZW9zID0gZGF0YS5tYXAoKG4pID0+IHsKICAgICAgICBsZXQgaWQgPSBuLnVybDsKICAgICAgICBsZXQgbmFtZSA9IG4ubGVhZ3VlX25hbWVfemggKyAnICcgKyBuLmhvbWVfdGVhbV96aCArICcgVlMgJyArIG4uYXdheV90ZWFtX3poOwogICAgICAgIGxldCBwaWMgPSBuLmNvdmVyOwogICAgICAgIGxldCByZW1hcmtzID0gbi5uaWNrbmFtZTsKICAgICAgICByZXR1cm4gewogICAgICAgICAgICB2b2RfaWQ6IGlkLAogICAgICAgICAgICB2b2RfbmFtZTogbmFtZSwKICAgICAgICAgICAgdm9kX3BpYzogcGljLAogICAgICAgICAgICB2b2RfcmVtYXJrczogcmVtYXJrcywKICAgICAgICB9OwogICAgfSk7CiAgICByZXR1cm4gdmlkZW9zCn0KdmFyIHJ1bGUgPSB7CiAgICDnsbvlnos6ICflvbHop4YnLC8v5b2x6KeGfOWQrOS5pnzmvKvnlLt85bCP6K+0CiAgICB0aXRsZTogJzM2MOWQp1vnkINdJywKICAgIGhvc3Q6ICdodHRwczovL20uMzYwYmEuY28vJywKICAgIGhvbWVVcmw6ICcvYXBpL3dlYi9oNV9pbmRleCcsCiAgICB1cmw6ICcvYXBpL3dlYi9saXZlX2xpc3RzL2Z5Y2xhc3MnLAogICAgc2VhcmNoVXJsOiAnL2FwaS93ZWIvc2VhcmNoP2tleXdvcmQ9KionLAogICAgc2VhcmNoYWJsZTogMiwKICAgIHF1aWNrU2VhcmNoOiAwLAogICAgZmlsdGVyYWJsZTogMCwKICAgIGhlYWRlcnM6IHsKICAgICAgICAnVXNlci1BZ2VudCc6ICdNT0JJTEVfVUEnLAogICAgfSwKICAgIHRpbWVvdXQ6IDUwMDAsCiAgICBjbGFzc19uYW1lOiAn5YWo6YOoJui2s+eQgybnr67nkIMm57u85ZCIJywKICAgIGNsYXNzX3VybDogJzEmMiYzJjk5JywKICAgIHBsYXlfcGFyc2U6IHRydWUsCiAgICBwYWdlY291bnQ6IHsKICAgICAgICAiMSI6IDEsCiAgICAgICAgIjIiOiAxLAogICAgICAgICIzIjogMSwKICAgICAgICAiOTkiOiAxLAogICAgfSwKICAgIGxhenk6ICRqcy50b1N0cmluZygoKSA9PiB7CiAgICAgICAgaW5wdXQgPSB7cGFyc2U6IDAsIHVybDogaW5wdXQsIGhlYWRlcjogcnVsZS5oZWFkZXJzfTsKICAgIH0pLAogICAg6aKE5aSE55CGOiAkanMudG9TdHJpbmcoKCkgPT4gewogICAgICAgIE9iamVjdC5hc3NpZ24ocnVsZS5oZWFkZXJzLCB7CiAgICAgICAgICAgICdSZWZlcmVyJzogcnVsZS5ob3N0LAogICAgICAgICAgICAnT3JpZ2luJzogcnVsZS5ob3N0LAogICAgICAgIH0pOwogICAgfSksCiAgICDmjqjojZA6ICRqcy50b1N0cmluZygoKSA9PiB7CiAgICAgICAgVk9EUyA9IGdldFZpZGVvcyhpbnB1dCwgJ2hvdF9tYXRjaGVzJyk7CgogICAgfSksCiAgICDkuIDnuqc6ICRqcy50b1N0cmluZygoKSA9PiB7CiAgICAgICAgVk9EUyA9IFtdOwogICAgICAgIGlmIChNWV9QQUdFIDw9IDEpIHsKICAgICAgICAgICAgVk9EUyA9IGdldFZpZGVvcyhpbnB1dCwgJ2RhdGEnKTsKICAgICAgICB9CiAgICB9KSwKICAgIOS6jOe6pzogJyonLAogICAg5pCc57SiOiAkanMudG9TdHJpbmcoKCkgPT4gewogICAgICAgIFZPRFMgPSBbXTsKICAgICAgICBpZiAoTVlfUEFHRSA8PSAxKSB7CiAgICAgICAgICAgIFZPRFMgPSBnZXRWaWRlb3MoaW5wdXQsICdiYWxsJyk7CiAgICAgICAgfQogICAgfSksCn0= |