logo AlgoBeat OnlineJudge
登录 注册

#217782. [JAG 2026 Summer Camp #1] Neighbour or Opposite

内存限制:2048 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

There are seats arranged in a circle, numbered in clockwise order.

For each (), seats and are neighbours. Seats and are also neighbours.

For each (), seats and are opposite each other.

Some of the seats are occupied. For each (), seat is occupied by exactly one person if is o, and is empty if is x.

You want to form pairs of people subject to the following conditions.

  • Each person belongs to at most one pair.
  • Each pair consists of two people seated in neighbouring or opposite seats.

Find the maximum possible number of pairs and the number of ways to achieve this maximum.

Two ways of forming pairs are considered different if their sets of unordered pairs differ.

输入格式

The input consists of a single test case of the following format.

N
S

The first line contains an integer ().

The second line contains a string of length consisting of o and x.

输出格式

Print two integers separated by a space.

The first integer is the maximum possible number of pairs.

The second integer is the number of ways to achieve this maximum, modulo .

样例

样例输入 1

3
ooxoxx

样例输出 1

1 2

样例输入 2

2
oooo

样例输出 2

2 3

样例输入 3

4
xxxxxxxx

样例输出 3

0 1