{"problem":{"name":"J. Judgement","description":{"content":"The jury of Berland regional olympiad in informatics does not trust to contest management systems, so the Berland regional programming contest is judged by the next way. There are n judges in the jury","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10091J"},"statements":[{"statement_type":"Markdown","content":"The jury of Berland regional olympiad in informatics does not trust to contest management systems, so the Berland regional programming contest is judged by the next way. There are n judges in the jury, each judge have authority ai. When jury receives a diskette with the new solution, each jury member reads its source and votes \"OK\" or \"WA\". If after the voting ends the sum of authorities of jury members, who think that solution is correct, is equal or greater to p, then soluton is accepted, otherwise it is rejected.\n\nSeveral jury members think, that current system is too complicated for them and proposed some changes: each jury member will have new authority bi, and limit is changed to q; then, in their opinion, calculations will be easier, and nothing more changes. \n\nYou are hired by the Department of Education of Berland region to check if the new system is equivalent to old one, i.e. that at any possible distribution of votes final verdict with the new and with the old parameters will be the same. If the systems differ, output an example of voting, when verdicts in both systems are different.\n\nFirst line of the input contains one integer n (1 ≤ n ≤ 100) — number of judges in the jury.\n\nSecond line contains n + 1 integers p, a1, a2, ..., an (1 ≤ p, ai ≤ 106) — the current acception limit and the current values of authorities of jury members, respectively.\n\nThird line contains n + 1 integers q, b1, b2, ..., bn (1 ≤ q, bi ≤ 106) — the new acception limit and the new values of authorities of jury members, respectively.\n\nIf old and new systems are equivalent, print \"_YES_\". Otherwise in the first line of output print \"_NO_\", and in second print example of voting, with different verdicts in old and new systems. Voting is encoded with the string of length n, where i-th character is '_1_', if i-th judge considered solution correct and '_0_' otherwise.\n\nIf several answers are possible, print any of them.\n\n## Input\n\nFirst line of the input contains one integer n (1 ≤ n ≤ 100) — number of judges in the jury.Second line contains n + 1 integers p, a1, a2, ..., an (1 ≤ p, ai ≤ 106) — the current acception limit and the current values of authorities of jury members, respectively.Third line contains n + 1 integers q, b1, b2, ..., bn (1 ≤ q, bi ≤ 106) — the new acception limit and the new values of authorities of jury members, respectively.\n\n## Output\n\nIf old and new systems are equivalent, print \"_YES_\". Otherwise in the first line of output print \"_NO_\", and in second print example of voting, with different verdicts in old and new systems. Voting is encoded with the string of length n, where i-th character is '_1_', if i-th judge considered solution correct and '_0_' otherwise.If several answers are possible, print any of them.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of judges.  \nLet $ \\mathbf{a} = (a_1, a_2, \\dots, a_n) \\in \\mathbb{Z}^n $ be the original authorities.  \nLet $ p \\in \\mathbb{Z}^+ $ be the original acceptance threshold.  \nLet $ \\mathbf{b} = (b_1, b_2, \\dots, b_n) \\in \\mathbb{Z}^n $ be the new authorities.  \nLet $ q \\in \\mathbb{Z}^+ $ be the new acceptance threshold.  \n\nLet $ V = \\{0,1\\}^n $ be the set of all possible voting vectors, where $ v_i = 1 $ if judge $ i $ votes \"OK\", else $ 0 $.  \n\n**Constraints**  \n$ 1 \\leq n \\leq 100 $,  \n$ 1 \\leq p, q, a_i, b_i \\leq 10^6 $ for all $ i \\in \\{1, \\dots, n\\} $.  \n\n**Objective**  \nDetermine whether for all $ \\mathbf{v} \\in V $:  \n$$\n\\sum_{i=1}^n v_i a_i \\geq p \\iff \\sum_{i=1}^n v_i b_i \\geq q\n$$  \nIf not, output any $ \\mathbf{v} \\in V $ such that:  \n$$\n\\left( \\sum_{i=1}^n v_i a_i \\geq p \\right) \\oplus \\left( \\sum_{i=1}^n v_i b_i \\geq q \\right)\n$$  \n(i.e., the verdicts differ).","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10091J","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}