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

Poredak

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

의견: 0

설명

\(3^{rd}\) round, December \(15^{th}\), 2012

Mir\(ko-wa\)n has just received the results of his history exam. One of the problems was putting famous
historical battles into chronological order. The correct order was:
1. Blockade of Naboo 2. Battle of Geonosis 3. Battle of Yavin 4. Battle of Hoth 5. Battle of Endor
Mir\(ko-wa\)n has studied (relatively) hard for the exam, so he remembered the exact years of all battles,
except for the Blockade of Naboo. He couldn't remember anything about it, so he randomly placed it
last instead of first, obtaining the order:
1. Battle of Geonosis 2. Battle of Yavin 3. Battle of Hoth 4. Battle of Endor 5. Blockade of Naboo
Since Mir\(ko-wa\)n's order doesn't match the correct solution at any index, Mir\(ko-wa\)n's score on that
problem was – to his disappointment – 0 out of 5 points, even though he knew the correct order of
four out of five battles!
This opens the question of fair scoring of an ordering problem. The example given above suggests that
scoring by counting the number of items in the correct absolute position isn't fair. Is there a better way?
One possibility is finding the longest subsequence (not necessarily contiguous) of correctly ordered
items. This isn't the best solution either: if an item is displaced by just one position from the correct
order, the score that it awards drops to zero, even though it was almost correctly ordered.
Mir\(ko-wa\)n has thus suggested (using the MAWT – Might As Well Try a Mind Trick approach) the
following scoring method to his history teacher. For every two items, the student will receive 1 point
if the two items are in mutually correct order. In other words, the number of points is the number of
item pairs that the student has correctly ordered. The maximum number of points is then, of course,
the total number of pairs, which equals N * (\(N - 1\)) / 2, where N is the total number of entries.

제약
입력 형식

The first line of input contains the positive integer N (\(2 \le N \le 2500\)), the number of items. The items
are distinct words consisting of 3 to 15 lowercase English letters.
The second line of input contains the N items, spa\(ce-se\)parated, listed in the correct order.
The third line of input contains the N items, spa\(ce-se\)parated, listed in Mir\(ko-wa\)n's order.

출력 형식

The first and only line of output must contain, with no spaces, the following: the number of points that
Mir\(ko-wa\)n would earn using his scoring method, a / (forward slash) character, and the maximum
possible number of points for that problem (again assuming Mir\(ko-wa\)n's scoring method). (This is the
usual notation found on a typical graded exam.)
\(3^{rd}\) round, December \(15^{th}\), 2012

예제 1
입력
3
alpha beta gamma
alpha gamma beta
출력
2/3
예제 2
입력
5
naboo geonosis yavin hoth endor
geonosis yavin hoth endor naboo
출력
6/10
설명

Clarification of the first example: Mirko-wan has received points for the pairs (alpha, beta) and
(alpha, gamma).

문제 정보

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

출처 COCI 2012/2013 Contest 3

평가 및 의견

Poredak

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

Log in to rate problems.

개별 의견

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

풀이 제출

Poredak

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