{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n h1 { font-size: 1.2em; }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n\u003cdiv class\u003d\"md\"\u003e\u003cp\u003eThere are \u003cspan class\u003d\"math inline\"\u003e$ n $\u003c/span\u003e boys and \u003cspan class\u003d\"math inline\"\u003e$ m $\u003c/span\u003e girls in a school. Next week a school dance will be organized. A dance pair consists of a boy and a girl, and there are \u003cspan class\u003d\"math inline\"\u003e$ k $\u003c/span\u003e potential pairs.\u003c/p\u003e\n\u003cp\u003eYour task is to find out the maximum number of dance pairs and show how this number can be achieved.\u003c/p\u003e\n\u003ch1 id\u003d\"input\"\u003eInput\u003c/h1\u003e\n\u003cp\u003eThe first input line has three integers \u003cspan class\u003d\"math inline\"\u003e$ n $\u003c/span\u003e, \u003cspan class\u003d\"math inline\"\u003e$ m $\u003c/span\u003e and \u003cspan class\u003d\"math inline\"\u003e$ k $\u003c/span\u003e: the number of boys, girls, and potential pairs. The boys are numbered \u003cspan class\u003d\"math inline\"\u003e$ 1,2,\\dots,n $\u003c/span\u003e, and the girls are numbered \u003cspan class\u003d\"math inline\"\u003e$ 1,2,\\dots,m $\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003eAfter this, there are \u003cspan class\u003d\"math inline\"\u003e$ k $\u003c/span\u003e lines describing the potential pairs. Each line has two integers \u003cspan class\u003d\"math inline\"\u003e$ a $\u003c/span\u003e and \u003cspan class\u003d\"math inline\"\u003e$ b $\u003c/span\u003e: boy \u003cspan class\u003d\"math inline\"\u003e$ a $\u003c/span\u003e and girl \u003cspan class\u003d\"math inline\"\u003e$ b $\u003c/span\u003e are willing to dance together.\u003c/p\u003e\n\u003ch1 id\u003d\"output\"\u003eOutput\u003c/h1\u003e\n\u003cp\u003eFirst print one integer \u003cspan class\u003d\"math inline\"\u003e$ r $\u003c/span\u003e: the maximum number of dance pairs. After this, print \u003cspan class\u003d\"math inline\"\u003e$ r $\u003c/span\u003e lines describing the pairs. You can print any valid solution.\u003c/p\u003e\n\u003ch1 id\u003d\"constraints\"\u003eConstraints\u003c/h1\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cspan class\u003d\"math inline\"\u003e$ 1 \\le n,m \\le 500 $\u003c/span\u003e\u003c/li\u003e\n\u003cli\u003e\u003cspan class\u003d\"math inline\"\u003e$ 1 \\le k \\le 1000 $\u003c/span\u003e\u003c/li\u003e\n\u003cli\u003e\u003cspan class\u003d\"math inline\"\u003e$ 1 \\le a \\le n $\u003c/span\u003e\u003c/li\u003e\n\u003cli\u003e\u003cspan class\u003d\"math inline\"\u003e$ 1 \\le b \\le m $\u003c/span\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch1 id\u003d\"example\"\u003eExample\u003c/h1\u003e\n\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3 2 4\n1 1\n1 2\n2 1\n3 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n1 2\n3 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e "}}]}