포럼
문제 ICPC00373

A. Adolescent Architecture 2

설명

Three years ago, you helped little Peter stack his toy blocks into a tower. Since then, he has extended his collection of toy blocks, which now features the following base shapes:
- circle \(a\) – a circle of radius \(a\);
- square \(a\) – a square with side length \(a\);
- triangle \(a\) – an equilateral triangle with side length \(a\).

Here, \(a\) may be any positive integer. The top shapes of each block are the same as their bottom shapes, so the blocks are cuboids, cylinders, and triangular prisms, respectively. Peter has an infinite supply of blocks of each shape and size.

Peter and his friend Amy are playing a two-player game, where the blocks need to be stacked on top of each other. Initially, some blocks are already placed on the floor. In each move, the current player must take a toy block from the infinite supply and put it on top of one of the existing stacks of blocks. The block may be rotated around its vertical axis before placing it. The outline of the new block must be strictly within the outline of the old block; the outlines are not allowed to touch. The first player who is unable to make a move loses the game.

Given the initial configuration, determine the number of winning moves for the first player.

제약
입력 형식

The input consists of:
- One line with an integer \(n\) (\(1 \le n \le 1000\)), the number of initial stacks.
- \(n\) lines, each with a string \(s\) (\(s\) is one of "circle", "square" or "triangle") and an integer \(a\) (\(1 \le a \le 10^9\)), giving the topmost blocks of the initial stacks as described above.

출력 형식

Output the number of winning moves for the first player.

예제 1
입력
2
circle 2
triangle 2
출력
2
예제 2
입력
2
circle 1
circle 2
출력
3
예제 3
입력
5
circle 123
triangle 456
square 789
square 789
triangle 555
출력
7
예제 4
입력
3
circle 299303201
square 79724391
triangle 437068198
출력
3
예제 5
입력
3
square 539715887
circle 518408351
triangle 348712924
출력
0
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC GCPC 2023

평가 및 의견

A. Adolescent Architecture 2

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

A. Adolescent Architecture 2

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