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

It's Mooin' Time II

Silver I 실버 I
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Farmer John is trying to describe his favorite USACO contest to Elsie, but she
is having trouble understanding why he likes it so much. He says "My favorite
part of the contest was when Bessie said 'It's Mooin' Time' and mooed all over
the contest."

Elsie still doesn't understand, so Farmer John downloads the contest as a text
file and tries to explain what he means. The contest is defined as an array of
\(N\) (\(1\le N\le 10^6\)) integers \(a_1, a_2, \dots, a_N\) (\(1\le a_i\le N\)). Farmer
John defines a moo as an array of three integers where the second integer
equals the third but not the first. A moo is said to occur in the contest if it
is possible to remove integers from the array until only the moo remains.

As Bessie allegedly "mooed all over the contest", help Elsie count the number of
distinct moos that occur in the contest! Two moos are distinct if they do not consist of the same integers in the same
order.

Problem credits: Benjamin Qi

제약

SCORING

  • Inputs 2-4: \(N\le 10^2\)
  • Inputs 5-7: \(N\le 10^4\)
  • Inputs 8-11: No additional constraints.

Problem credits: Benjamin Qi

입력 형식

The first line contains \(N\).

The second line contains \(N\) space-separated integers \(a_1,a_2,\dots,a_N\).

출력 형식

Output the number of distinct moos that occur in the contest.

*Note that the large size of integers involved in this problem may require
the use of 64-bit integer data types (e.g., a "long" in Java, a "long long" in
C/C++).
*

예제 1
입력
6
1 2 3 4 4 4
출력
3
설명

This contest has three distinct moos: "1 4 4", "2 4 4", and "3 4 4".

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2024-2025 > January > Bronze

태그

평가 및 의견

It's Mooin' Time II

개요
출제자 난이도 Silver I 실버 I 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

It's Mooin' Time II

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