Robot Factory

AtCoder
IDabc431_c
Time2000ms
Memory256MB
Difficulty
Takahashi can combine a head part and a body part to create a robot. A robot falls over if the weight of the head part is greater than the weight of the body part. Currently, he has $N$ head parts and $M$ body parts. The weight of the $i$\-th $(1\le i\le N)$ head part is $H _ i$ grams, and the weight of the $i$\-th $(1\le i\le M)$ body part is $B _ i$ grams. He wants to create a total of $K$ robots that do not fall over by appropriately combining the parts he has. Determine whether he can achieve his goal by combining the parts well. Here, a part cannot be used to create multiple robots, and two or more head parts (or two or more body parts) cannot be used to create one robot. ## Constraints * $1\le N\le2\times10 ^ 5$ * $1\le M\le2\times10 ^ 5$ * $1\le K\le\min\lbrace N,M\rbrace$ * $1\le H _ i\le10 ^ 9\ (1\le i\le N)$ * $1\le B _ i\le10 ^ 9\ (1\le i\le M)$ * All input values are integers. ## Input The input is given from Standard Input in the following format: $N$ $M$ $K$ $H _ 1$ $H _ 2$ $\ldots$ $H _ N$ $B _ 1$ $B _ 2$ $\ldots$ $B _ M$ [samples]
Samples
Input #1
6 6 3
2 7 1 8 2 8
1 8 2 8 4 5
Output #1
Yes

If we denote combining the $i$\-th head part and the $j$\-th body part as $(i,j)$, then Takahashi can create three robots that do not fall over by combining them as $(1,2),(2,4),(3,6)$, for example.
Thus, print `Yes`.
Input #2
1 1 1
43
1
Output #2
No

His head part is too heavy, so he cannot create any robot that does not fall over.
Input #3
1 1 1
100
100
Output #3
Yes

Note that a robot does not fall over if the head and body have equal weights.
Input #4
12 15 12
748 169 586 329 972 529 432 519 408 587 138 249
656 114 632 299 984 755 404 772 155 506 832 854 353 465 387
Output #4
Yes
API Response (JSON)
{
  "problem": {
    "name": "Robot Factory",
    "description": {
      "content": "Takahashi can combine a head part and a body part to create a robot. A robot falls over if the weight of the head part is greater than the weight of the body part. Currently, he has $N$ head parts and",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc431_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Takahashi can combine a head part and a body part to create a robot. A robot falls over if the weight of the head part is greater than the weight of the body part.\nCurrently, he has $N$ head parts and...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments