RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0063 파일 입출력

Meet and Greet

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

의견: 0

설명

As is commonly known, cows are very socially polite creatures: any time two cows meet after being apart, they greet each-other with a friendly "moo".

Bessie the cow and her friend, Elsie, are walking around on a long path on Farmer John's farm. For all practical purposes, we can think of this path as a one-dimensional number line. Bessie and Elsie both start at the origin, and they both then begin walking around at identical speeds for some amount of time. Given a description of the movements taken by each cow, please determine the number of "moos" exchanged.

Bessie and Elsie can stop moving at different points in time, and neither cow will travel for more than 1,000,000 units of time.

제약
입력 형식

Line 1: Two space-separated integers, B (1 <= B <= 50,000) and E (1 <= E <= 50,000).

Lines 2..1+B: These B lines describe Bessie's movements. Each line contains a positive integer followed by either "L" or "R", indicating the distance Bessie moves in a direction that is either left or right.

Lines 2+B..1+B+E: These E lines describe Elsie's movements, in the same format.

출력 형식

An integer specifying the number of "moos" exchanged by the two cows. Their initial shared starting position at the origin does not cause a "moo".

파일 입력 / 출력
이 문제는 표준 입출력을 사용하지 않습니다. 프로그램은 다음 파일을 읽고 써야 합니다:
입력을 읽을 파일 greetings.in
출력을 쓸 파일 greetings.out
예제 1
입력
4 5
3 L
5 R
1 L
2 R
4 R
1 L
3 L
4 R
2 L
출력
3
설명

Output details: Bessie and Elsie meet after being temporarily apart at time 7, time 9, and time 13.

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2012-2013 > December > Bronze

태그

평가 및 의견

Meet and Greet

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

Log in to rate problems.

개별 의견

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

풀이 제출

Meet and Greet

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