Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

.eslintcache
*.bak
2 changes: 2 additions & 0 deletions src/interfaces/MergedProblem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export interface MergedProblem extends Problem {
readonly Difficulty?: Difficulty;
/** experimental difficulty かどうか */
readonly Augmented?: boolean;
/** コンテスト中の問題インデックス */
readonly Index?: number;
}

/** コンテスト情報,解答状況,およびショートコード情報をマージした問題 */
Expand Down
5 changes: 4 additions & 1 deletion src/pages/ListPage/ListTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
import { ProblemDetailModal } from '../../components/ProblemDetailModal';
import { useNavigate } from 'react-router';
import { useSearchParams } from 'react-router-dom';
import { getHeader } from '../../utils';

export type FilterState = 'All' | 'Only Trying' | 'Only AC';

Expand Down Expand Up @@ -115,9 +116,11 @@ export const ListTable: React.FC<Props> = (props) => {
title: string,
row: RankingMergedProblem
) {
const header =
row.Index !== undefined ? `${getHeader(row.Index)}. ` : '';
return (
<ProblemLink
problemTitle={title}
problemTitle={`${header}${title}`}
problemNo={row.No as ProblemNo}
level={row.Level}
problemLinkColorMode={problemLinkColorMode}
Expand Down
8 changes: 7 additions & 1 deletion src/pages/ProblemDetailPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { ContestLink } from '../../components/ContestLink';
import { ProblemTypeIconSpanWithName } from '../../components/ProblemTypeIcon';
import { TabbedDifficultyChart } from './TabbedDifficultyChart';
import { useResetScroll } from '../../utils/UseResetScroll';
import { getHeader } from '../../utils';

const initialUniversalState = {
problem: {} as Problem,
Expand Down Expand Up @@ -96,6 +97,11 @@ export const ProblemDetailPage: React.FC = () => {

const contestId = problemContestMap.get(problemId);
const contest = contestId ? contestMap.get(contestId) : undefined;
const header = contest
? `${getHeader(
contest.ProblemIdList.findIndex((pid) => pid === problem.ProblemId)
)}. `
: '';

const shortestRankingProblem = golferProblemMap.get(problemId);
const pureShortestRankingProblem = golferPureProblemMap.get(problemId);
Expand Down Expand Up @@ -157,7 +163,7 @@ export const ProblemDetailPage: React.FC = () => {
<th>Title</th>
<td>
<ProblemLink
problemTitle={problem.Title}
problemTitle={`${header}${problem.Title}`}
problemNo={problem.No as ProblemNo}
level={problem.Level}
problemLinkColorMode={colorMode}
Expand Down
10 changes: 10 additions & 0 deletions src/utils/MergeProcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ export const mergeSolveStatus = (
}),
new Map<ContestId, ExtendedContest>()
);
const problemIndexMap = contests.reduce((map, contest) => {
contest.ProblemIdList.forEach((pid, i) => {
if (pid < 0) return;
map.set(pid, i);
});
return map;
}, new Map<ProblemId, number>());
const mergedProblems = problems.map(
(problem): MergedProblem => {
const DateNum = Date.parse(problem.Date as string);
Expand Down Expand Up @@ -66,6 +73,7 @@ export const mergeSolveStatus = (
SolveStatus,
Difficulty,
Augmented,
Index: undefined,
};
}
// assert コンテスト情報あり
Expand All @@ -78,6 +86,7 @@ export const mergeSolveStatus = (
SolveStatus: ProblemSolveStatus.Trying,
Difficulty,
Augmented,
Index: problemIndexMap.get(problem.ProblemId),
};
}
// assert AC 済み
Expand All @@ -102,6 +111,7 @@ export const mergeSolveStatus = (
SolveStatus,
Difficulty,
Augmented,
Index: problemIndexMap.get(problem.ProblemId),
};
}
);
Expand Down