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

S1. Sum Game

Unrated 레이팅 미적용
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Time limit: 1 second

Annie has two favourite baseball teams: the Swifts and the
Semaphores. She has followed them throughout the season, which is now
over. The season lasted for \(N\) days.
Both teams played exactly one game on each day.

For each day, Annie recorded the number of runs scored by the Swifts
on that day. She also recorded this information for the Semaphores.

She would like you to determine the largest integer \(K\) such that \(K \leq N\) and the Swifts and the Semaphores had scored the same
total number of runs \(K\) days after
the start of the season. The total number of runs scored by a team after
\(K\) days is the sum of the number of
runs scored by the team in all games before or on the \(K\)-th day.

For example, if the Swifts and the Semaphores have the same total
number of runs at the end of the season, then you should output \(N\). If the Swifts and the Semaphores never
had the same number of runs after \(K\)
games, for any value of \(K \leq N\),
then output 0.

제약

\(K \leq N\)
\((1 \leq N \leq 100\ 000)\)
\(N \leq 1000\)

입력 형식

The first line of
input will contain an integer \(N\)
\((1 \leq N \leq 100\ 000)\). The
second line will contain \(N\)
space-separated non-negative integers representing the number of runs
scored by the Swifts on each day, in order. The third line will contain
\(N\) space-separated non-negative
integers representing the number of runs scored by the Semaphores on
each day, in order. You may assume that each team scored at most 20 runs
in any single game.

For 7 of the 15 points available, \(N \leq 1000\).

출력 형식

Output the largest integer \(K\)
such that \(K \leq N\) and the Swifts
and the Semaphores have the same total number of runs after \(K\) days.

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

After 2 days, each team had scored a total of 4 runs.

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

The only time when the Swifts and the Semaphores had scored the same
number of runs was the beginning of the season.

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

The Swifts and Semaphores have the same number of total runs after
the first game, and after the third game, and after the fourth game. We
take the largest of these values (1, 3 and 4) and output 4.

문제 정보

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

출처 CCC 2017 Senior

평가 및 의견

S1. Sum Game

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

Log in to rate problems.

개별 의견

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

풀이 제출

S1. Sum Game

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