Skip to content

Commit 142f802

Browse files
authoredFeb 8, 2024
Merge branch 'master' into master
2 parents 37de88f + 5568d4b commit 142f802

34 files changed

+302
-115
lines changed
 

‎.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
extends: [
88
'eslint:recommended',
99
'plugin:react/recommended',
10+
'plugin:react-hooks/recommended',
1011
'plugin:@typescript-eslint/recommended',
1112
'plugin:jest/recommended',
1213
],

‎.github/workflows/test.yml

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ jobs:
3333
- name: Install dependencies
3434
run: yarn
3535

36+
# hack to build graphql types
37+
- name: Build GraphQL types
38+
run: grep -m 1 "Generating GraphQL and TypeScript types" <(yarn develop) | true
39+
env:
40+
NODE_OPTIONS: --max-old-space-size=4096
41+
3642
- name: Run tests
3743
run: yarn test --passWithNoTests
3844

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ typings/
5757
# gatsby files
5858
.cache/
5959
public
60+
src/gatsby-types.d.ts
6061

6162
# Mac files
6263
.DS_Store

‎content/3_Silver/Sorting_Custom.problems.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"name": "Lifeguards",
6262
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=786",
6363
"source": "Silver",
64-
"difficulty": "Easy",
64+
"difficulty": "Normal",
6565
"isStarred": false,
6666
"tags": ["Sorting", "Prefix Sums"],
6767
"solutionMetadata": {

‎content/4_Gold/Tree_Euler.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ $\text{dfs}(5, 3)$.
330330
<tr>
331331
<td>$\texttt{end}$</td>
332332
<td>0</td>
333-
<td>1</td>
333+
<td>2</td>
334334
<td>0</td>
335335
<td>0</td>
336336
<td>0</td>

‎content/6_Advanced/Vectorization.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ id: vectorization
33
title: Vectorization in C++
44
author: Benjamin Qi, Aryansh Shrivastava
55
description: '?'
6+
frequency: 0
67
---
78

89
[Pragmas](https://gcc.gnu.org/onlinedocs/cpp/Pragmas.html) provide additional

‎content/extraProblems.json

+156
Original file line numberDiff line numberDiff line change
@@ -1914,6 +1914,162 @@
19141914
"kind": "USACO",
19151915
"usacoId": "1358"
19161916
}
1917+
},
1918+
{
1919+
"uniqueId": "usaco-1371",
1920+
"name": "Majority Opinion",
1921+
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=1371",
1922+
"source": "Bronze",
1923+
"difficulty": "N/A",
1924+
"isStarred": false,
1925+
"tags": [],
1926+
"solutionMetadata": {
1927+
"kind": "USACO",
1928+
"usacoId": "1371"
1929+
}
1930+
},
1931+
{
1932+
"uniqueId": "usaco-1372",
1933+
"name": "Cannonball",
1934+
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=1372",
1935+
"source": "Bronze",
1936+
"difficulty": "N/A",
1937+
"isStarred": false,
1938+
"tags": [],
1939+
"solutionMetadata": {
1940+
"kind": "USACO",
1941+
"usacoId": "1372"
1942+
}
1943+
},
1944+
{
1945+
"uniqueId": "usaco-1373",
1946+
"name": "Balancing Bacteria",
1947+
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=1373",
1948+
"source": "Bronze",
1949+
"difficulty": "N/A",
1950+
"isStarred": false,
1951+
"tags": [],
1952+
"solutionMetadata": {
1953+
"kind": "USACO",
1954+
"usacoId": "1373"
1955+
}
1956+
},
1957+
{
1958+
"uniqueId": "usaco-1374",
1959+
"name": "Cowmpetency",
1960+
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=1374",
1961+
"source": "Silver",
1962+
"difficulty": "N/A",
1963+
"isStarred": false,
1964+
"tags": [],
1965+
"solutionMetadata": {
1966+
"kind": "USACO",
1967+
"usacoId": "1374"
1968+
}
1969+
},
1970+
{
1971+
"uniqueId": "usaco-1375",
1972+
"name": "Potion Farming",
1973+
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=1375",
1974+
"source": "Silver",
1975+
"difficulty": "N/A",
1976+
"isStarred": false,
1977+
"tags": [],
1978+
"solutionMetadata": {
1979+
"kind": "USACO",
1980+
"usacoId": "1375"
1981+
}
1982+
},
1983+
{
1984+
"uniqueId": "usaco-1376",
1985+
"name": "Cowlendar",
1986+
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=1376",
1987+
"source": "Silver",
1988+
"difficulty": "N/A",
1989+
"isStarred": false,
1990+
"tags": [],
1991+
"solutionMetadata": {
1992+
"kind": "USACO",
1993+
"usacoId": "1376"
1994+
}
1995+
},
1996+
{
1997+
"uniqueId": "usaco-1377",
1998+
"name": "Walking in Manhattan",
1999+
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=1377",
2000+
"source": "Gold",
2001+
"difficulty": "N/A",
2002+
"isStarred": false,
2003+
"tags": [],
2004+
"solutionMetadata": {
2005+
"kind": "USACO",
2006+
"usacoId": "1377"
2007+
}
2008+
},
2009+
{
2010+
"uniqueId": "usaco-1378",
2011+
"name": "Cowmpetency",
2012+
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=1378",
2013+
"source": "Gold",
2014+
"difficulty": "N/A",
2015+
"isStarred": false,
2016+
"tags": [],
2017+
"solutionMetadata": {
2018+
"kind": "USACO",
2019+
"usacoId": "1378"
2020+
}
2021+
},
2022+
{
2023+
"uniqueId": "usaco-1379",
2024+
"name": "Nap Sort",
2025+
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=1379",
2026+
"source": "Gold",
2027+
"difficulty": "N/A",
2028+
"isStarred": false,
2029+
"tags": [],
2030+
"solutionMetadata": {
2031+
"kind": "USACO",
2032+
"usacoId": "1379"
2033+
}
2034+
},
2035+
{
2036+
"uniqueId": "usaco-1380",
2037+
"name": "Island Vacation",
2038+
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=1380",
2039+
"source": "Platinum",
2040+
"difficulty": "N/A",
2041+
"isStarred": false,
2042+
"tags": [],
2043+
"solutionMetadata": {
2044+
"kind": "USACO",
2045+
"usacoId": "1380"
2046+
}
2047+
},
2048+
{
2049+
"uniqueId": "usaco-1381",
2050+
"name": "Merging Cells",
2051+
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=1381",
2052+
"source": "Platinum",
2053+
"difficulty": "N/A",
2054+
"isStarred": false,
2055+
"tags": [],
2056+
"solutionMetadata": {
2057+
"kind": "USACO",
2058+
"usacoId": "1381"
2059+
}
2060+
},
2061+
{
2062+
"uniqueId": "usaco-1382",
2063+
"name": "Mooball Teams III",
2064+
"url": "http://www.usaco.org/index.php?page=viewproblem2&cpid=1382",
2065+
"source": "Platinum",
2066+
"difficulty": "N/A",
2067+
"isStarred": false,
2068+
"tags": [],
2069+
"solutionMetadata": {
2070+
"kind": "USACO",
2071+
"usacoId": "1382"
2072+
}
19172073
}
19182074
]
19192075
}

‎content/ordering.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const MODULE_ORDERING: { [key in SectionID]: Chapter[] } = {
7171
bronze: [
7272
{
7373
name: 'Getting Started',
74-
items: ['time-comp', 'intro-ds', 'simulation', 'rect-geo'],
74+
items: ['time-comp', 'intro-ds', 'simulation'],
7575
},
7676
{
7777
name: 'Complete Search',
@@ -83,7 +83,7 @@ const MODULE_ORDERING: { [key in SectionID]: Chapter[] } = {
8383
},
8484
{
8585
name: 'Additional',
86-
items: ['ad-hoc', 'intro-greedy', 'intro-graphs'],
86+
items: ['ad-hoc', 'intro-greedy', 'intro-graphs', 'rect-geo'],
8787
},
8888
{
8989
name: 'Conclusion',

‎gatsby-config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,5 @@ module.exports = {
149149
flags,
150150
siteMetadata,
151151
plugins,
152+
graphqlTypegen: true,
152153
};

‎graphql.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./.cache/typegen/graphql.config.json');

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
"format": "prettier --write .",
165165
"lint": "npm run eslint",
166166
"eslint": "eslint --fix --ext .jsx --ext .js --ext .ts --ext .tsx --cache src",
167-
"check-ts-errors": "tsc --noEmit --strict false",
167+
"check-ts-errors": "tsc --noEmit",
168168
"start": "npm run develop",
169169
"serve": "gatsby serve",
170170
"clean": "gatsby clean",

‎solutions/bronze/usaco-1301.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int main() {
4444
long long cost = k + 1; // Start the first subscription
4545
for (long long d : days) {
4646
// Should Bessie extend the most recent subscription?
47-
if (d - last_day < k) {
47+
if (d - last_day < k + 1) {
4848
cost += d - last_day;
4949
} else {
5050
// Or just start a new one entirely?

‎src/components/Dashboard/ModuleLink.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ const ModuleLink = ({ link }: { link: ModuleLinkInfo }): JSX.Element => {
246246
) : null}
247247
</span>
248248
</p>
249-
{link.frequency && (
249+
{link.frequency !== null && (
250250
<p className="text-sm flex items-center leading-4 mb-1">
251251
<ModuleFrequencyDots
252252
count={link.frequency}

‎src/components/Groups/GroupPage/Feed.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ function SortableItem(props: {
3131
userPoints: number | null;
3232
isBeingDragged: boolean;
3333
}) {
34-
// probably post was just deleted before items updated
35-
if (!props.post) return null;
36-
3734
const { attributes, listeners, setNodeRef, transform, transition } =
3835
useSortable({ id: props.id });
3936

37+
// probably post was just deleted before items updated
38+
if (!props.post) return null;
39+
4040
const style = {
4141
transform: CSS.Transform.toString(transform),
4242
transition,

‎src/components/Groups/MembersPage/MembersPage.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import { Link } from 'gatsby';
22
import * as React from 'react';
33
import { useActiveGroup } from '../../../hooks/groups/useActiveGroup';
44
import useLeaderboardData from '../../../hooks/groups/useLeaderboardData';
5-
import getMemberInfoForGroup from '../../../hooks/groups/useMemberInfoForGroup';
5+
import useMemberInfoForGroup from '../../../hooks/groups/useMemberInfoForGroup';
66
import TopNavigationBar from '../../TopNavigationBar/TopNavigationBar';
77
import Layout from '../../layout';
88
import SEO from '../../seo';
99
import MemberDetail from './MemberDetail';
1010

1111
export default function MembersPage(): JSX.Element {
1212
const activeGroup = useActiveGroup();
13-
const memberInfo = getMemberInfoForGroup(activeGroup.groupData);
13+
const memberInfo = useMemberInfoForGroup(activeGroup.groupData);
1414
const leaderboard = useLeaderboardData({
1515
groupId: activeGroup.activeGroupId,
1616
maxResults: 200,

‎src/components/Groups/PostPage/PostProblems.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ function SortableItem(props: {
3131
post: PostData;
3232
problem: ProblemData;
3333
}) {
34-
if (!props.problem) return null;
35-
3634
const { attributes, listeners, setNodeRef, transform, transition } =
3735
useSortable({ id: props.id });
3836

37+
if (!props.problem) return null;
38+
3939
const style = {
4040
transform: CSS.Transform.toString(transform),
4141
transition,

‎src/components/Groups/ProblemSubmissionPopup.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ const ProblemSubmissionPopupContext = React.createContext<{
2020
function ProblemSubmissionPopup() {
2121
const popupContext = useContext(ProblemSubmissionPopupContext);
2222
const submission = popupContext.submission;
23-
const submissionResult =
24-
submission && 'submissionID' in submission
25-
? useProblemSubmissionResult(submission?.submissionID)
26-
: null;
27-
28-
if (!submission) return null;
23+
const submissionResult = useProblemSubmissionResult(
24+
submission && 'submissionID' in submission ? submission?.submissionID : null
25+
);
2926

3027
const isDarkMode = useDarkMode();
3128

29+
if (!submission) return null;
3230
return (
3331
<Transition
3432
show={popupContext.showPopup}

‎src/components/Groups/SafeMarkdownRenderer.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,14 @@ const GroupsCodeBlock = ({
6767
inline?: boolean;
6868
}) => {
6969
const value = children[0];
70+
const isDarkMode = useDarkMode();
7071
if (className === 'language-video') {
7172
return <VideoComponent link={value} />;
7273
}
7374
if (inline) {
7475
return <code>{value}</code>;
7576
}
7677

77-
const isDarkMode = useDarkMode();
78-
7978
return (
8079
<CodeBlock className={className} isDarkMode={isDarkMode}>
8180
{value}

‎src/components/MarkdownLayout/MarkdownLayout.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,11 @@ export default function MarkdownLayout({
119119
// document.querySelector('html').style.scrollBehavior = 'smooth';
120120
// return () => (document.querySelector('html').style.scrollBehavior = 'auto');
121121
// }, []);
122-
122+
const problemSolutionContext = React.useContext(ProblemSolutionContext);
123123
let activeIDs = [];
124124
if (markdownData instanceof ModuleInfo) {
125125
activeIDs.push(markdownData.id);
126126
} else {
127-
const problemSolutionContext = React.useContext(ProblemSolutionContext);
128127
activeIDs = problemSolutionContext.modulesThatHaveProblem.map(x => x.id);
129128
}
130129

0 commit comments

Comments
 (0)