PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#PS0000246. Lật quân Othello (Othello)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Lật quân Othello (Othello)

Othello

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

A row of NN two-sided pieces is numbered from 1 to NN. The black side is marked 0 and the white side 1. Initially every black side faces up. Perform QQ operations in order; operation ii flips every piece in the inclusive interval [li,ri][l_i,r_i]. Determine the final state.

Input

First line: N,QN,Q. Each of the next QQ lines contains li,ril_i,r_i.

Output

Print one string of exactly NN binary digits, with no spaces, from left to right.

Subtasks

  • Subtask 1 (60 points): 1≤N,Q≤20001\le N,Q\le 2000; 1≤li≤ri≤N1\le l_i\le r_i\le N.
  • Subtask 2 (40 points): 1≤N,Q≤2000001\le N,Q\le 200000; 1≤li≤ri≤N1\le l_i\le r_i\le N.

Example 1

Input

5 4
1 4
2 5
3 3
1 5

Output

01010

Explanation

The successive states are 00000, 11110, 10001, 10101, 01010.

Example 2

Input

20 8
1 8
4 13
8 8
3 18
5 20
19 20
2 7
4 9

Output

10110000011110000000

Explanation

Positions 1, 3, 4, 10, 11, 12 and 13 are flipped an odd number of times.