RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0567

FEB

Bronze II 브론즈 II
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Bessie and Elsie are plotting to overthrow Farmer John at last! They plan it out
over \(N\) (\(1\le N\le 2\cdot 10^5\)) text messages. Their conversation can be
represented by a string \(S\) of length \(N\) where \(S_i\) is either \(B\) or \(E\),
meaning the \(i\)th message was sent by Bessie or Elsie, respectively.

However, Farmer John hears of the plan and attempts to intercept their
conversation. Thus, some letters of \(S\) are \(F\), meaning Farmer John obfuscated
the message and the sender is unknown.

The excitement level of a non-obfuscated conversation is the number of
times a cow double-sends - that is, the number of occurrences of substring \(BB\)
or \(EE\) in \(S\). You want to find the excitement level of the original message,
but you don’t know which of Farmer John’s messages were actually Bessie’s
/ Elsie’s. Over all possibilities, output all possible excitement levels of
\(S\).

Problem credits: William Yue and Claire Zhang

제약

SCORING

  • Inputs 4-8: \(N\le 10\)
  • Inputs 9-20: No additional constraints.

Problem credits: William Yue and Claire Zhang

입력 형식

The first line will consist of one integer \(N\).

The next line contains \(S\).

출력 형식

First output \(K\), the number of distinct excitement levels possible. On the next
\(K\) lines, output the excitement levels, in increasing order.

예제 1
입력
4
BEEF
출력
2
1
2
예제 2
입력
9
FEBFEBFEB
출력
2
2
3
예제 3
입력
10
BFFFFFEBFE
출력
3
2
4
6
문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2022-2023 > US Open > Bronze

태그

평가 및 의견

FEB

개요
출제자 난이도 Bronze II 브론즈 II 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

FEB

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8