{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e现在森林中有 $$$n$$$ 个村庄,住着猎人与怪兽,有 $m$ 条路连接这些村庄且经过每条路都需要花费时间 $$$1$$$ 。\u003c/p\u003e\n\u003cp\u003e第$$$i$$$ 个村庄的怪兽的防御力为 $$$w_i$$$,当猎人的攻击力大于等于怪兽的防御力时,猎人能够猎杀到这个村庄的怪兽。\u003c/p\u003e\n\u003cp\u003e现在有$q$次询问,每次询问包含两个整数分别为$$$a_i,p_i$$$第$$$a_i$$$个村庄攻击力$$$p_i$$$的猎人要去打猎(可以打自家村庄的怪兽),请问猎人最少花费多少时间能打到怪兽?\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e第一行给定三个整数$$$n,m,q(1\\le n,m\\le 1e5,1\\le q\\le 5e5)$$$分别表示村庄,路以及询问的数量。\u003c/p\u003e\n\u003cp\u003e第二行$$$n$$$个整数,期中第$i$个整数表示第$i$个村庄怪兽的防御力为$$$w_i(1\\le w_i\\le 1e2)$$$。\u003c/p\u003e\n\u003cp\u003e接下来$$$m$$$行,每行包含两个整数$$$u_i,v_i(1\\le u_i,v_i\\le n,u_i\\not\u003dv_i)$$$表示村庄$$$u_i,v_i$$$之间有一条路。\u003c/p\u003e\n\u003cp\u003e最后$$$q$$$行,每行包含两个整数$$$p_i,a_i(1\\le p_i\\le n,1\\le a_i\\le 1e2)$$$表示第$$$p_i$$$个村庄攻击力为$$$a_i$$$的猎人要去打怪兽。\u003c/p\u003e\n"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e 每组样例输出$$$q$$$行,每行包含一个整数,表示询问答案。如果无法打到怪兽则输出-1\u003c/p\u003e"}},{"title":"Example","value":{"format":"HTML","content":"\u003cdiv class\u003d\"sample-test\"\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e4 4 5\n5 4 2 3\n1 2\n2 3\n3 4\n4 1\n1 1\n1 2\n1 3\n1 4\n1 5\n\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e-1\n2\n1\n1\n0\n\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}}]}