{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"PLAIN","content":"长度为n的全0的数组a,给一个数组b和q个操作{li, ri},每个操作将数组a指定区间改成1,问合理选择部分操作后使得符合ai≠bi 的i的个数最小。"}},{"title":"Constraints","value":{"format":"PLAIN","content":"•\t1≤N≤200,000\n•\tb 由0和1组成\n•\t1≤Q≤200,000\n•\t1≤li≤ri≤N\n•\t如果 i≠j, 要么li≠lj ,要么 ri≠rj.\n\n"}},{"title":"Input","value":{"format":"PLAIN","content":"N\nb1 b2 ... bN\nQ\nl1 r1\nl2 r2\n:\nlQ rQ\n\n"}},{"title":"Output","value":{"format":"PLAIN","content":"输出一个数表示答案"}},{"title":"Sample Input 1","value":{"format":"PLAIN","content":"1 0 1\n1\n1 3"}},{"title":"Sample Output 1","value":{"format":"PLAIN","content":"1"}},{"title":"Sample Input 2","value":{"format":"PLAIN","content":"3\n1 0 1\n2\n1 1\n3 3"}},{"title":"Sample Output 2","value":{"format":"PLAIN","content":"0"}},{"title":"Sample Input 3","value":{"format":"PLAIN","content":"3\n1 0 1\n2\n1 1\n2 3"}},{"title":"Sample Output 3","value":{"format":"PLAIN","content":"1"}},{"title":"Sample Input 4","value":{"format":"PLAIN","content":"5\n0 1 0 1 0\n1\n1 5"}},{"title":"Sample Output 4","value":{"format":"PLAIN","content":"2"}},{"title":"Sample Input 5","value":{"format":"PLAIN","content":"9\n0 1 0 1 1 1 0 1 0\n3\n1 4\n5 8\n6 7"}},{"title":"Sample Output 5","value":{"format":"PLAIN","content":"3"}},{"title":"Sample Input 6","value":{"format":"PLAIN","content":"15\n1 1 0 0 0 0 0 0 1 0 1 1 1 0 0\n9\n4 10\n13 14\n1 7\n4 14\n9 11\n2 6\n7 8\n3 12\n7 13"}},{"title":"Sample Output 6","value":{"format":"PLAIN","content":"5"}},{"title":"Sample Input 7","value":{"format":"PLAIN","content":"10\n0 0 0 1 0 0 1 1 1 0\n7\n1 4\n2 5\n1 3\n6 7\n9 9\n1 5\n7 9"}},{"title":"Sample Output 7","value":{"format":"PLAIN","content":"1"}}]}