#P2846. [USACO08NOV] Light Switching G
[USACO08NOV] Light Switching G
题目描述
Farmer John tries to keep the cows sharp by letting them play with intellectual toys. One of the larger toys is the lights in the barn. Each of the cow stalls conveniently numbered has a colorful light above it.
At the beginning of the evening, all the lights are off. The cows control the lights with a set of N pushbutton switches that toggle the lights; pushing switch i changes the state of light i from off to on or from on to off.
The cows read and execute a list of operations expressed as one of two integers ( operation ).
The first kind of operation (denoted by a command) includes two subsequent integers and that indicate a starting switch and ending switch. They execute the operation by pushing each pushbutton from through inclusive exactly once.
The second kind of operation (denoted by a command) asks the cows to count how many lights are on in the range given by two integers and which specify the inclusive range in which the cows should count the number of lights that are on.
Help FJ ensure the cows are getting the correct answer by processing the list and producing the proper counts.
输入格式
第 行: 用空格隔开的两个整数 和 , 是灯数,是指令数。
第 行: 每行表示一个操作, 有三个用空格分开的整数: 指令号, 和 。
输入
4 5
0 1 2
0 2 4
1 2 3
0 2 4
1 1 4
输出
1
2
提示
数据点编号 | ||
---|---|---|
相关
在以下作业中: