CF1209B Koala and Lights

题目描述

有 $n$ 盏灯泡,给定初始状态,第 $i$ 盏灯泡会在 $b_i,b_i+a_i,b_i+2 \times a_i$ 等时刻变成相反的状态,求在某一个时刻亮灯数的最大值。

输入格式

第一行包含一个整数 $n$ ($1 \leq n \leq 100$),表示有 $n$ 盏灯。 下一行包含一个 $n$ 个元素的字符串 $s$,如果 $s_i$ 为 $\verb!1!$,表示第 $i$ 盏灯初始是亮起的; 如果 $s_i$ 为 $\verb!0!$ ,表示第 $i$ 盏灯初始是熄灭的。 接下来 $n$ 行,每行包含两个整数 $a_i$ 和 $b_i$。

输出格式

一行,表示在某一时刻亮灯数的最大值。

说明/提示

For first example, the lamps' states are shown in the picture above. The largest number of simultaneously on lamps is $ 2 $ (e.g. at the moment $ 2 $ ). In the second example, all lights are initially on. So the answer is $ 4 $ .