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
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Lật quân Othello (Othello)
Othello
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
A row of two-sided pieces is numbered from 1 to . The black side is marked 0 and the white side 1. Initially every black side faces up. Perform operations in order; operation flips every piece in the inclusive interval . Determine the final state.
Input
First line: . Each of the next lines contains .
Output
Print one string of exactly binary digits, with no spaces, from left to right.
Subtasks
- Subtask 1 (60 points): ; .
- Subtask 2 (40 points): ; .
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.