Skip to content

Commit

Permalink
update cf 1882
Browse files Browse the repository at this point in the history
  • Loading branch information
DawnMagnet committed Sep 26, 2023
1 parent 6cac28c commit 377e683
Show file tree
Hide file tree
Showing 6 changed files with 2,108 additions and 1,903 deletions.
82 changes: 82 additions & 0 deletions docs/codeforces/1882.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Div.2 899 - ID: 1882

# [A 题](https://codeforces.com/contest/1882/problem/A)

```rust
fn solve() {
input! {
n: usz,
a: [usz; n]
}
let mut cur = 0;
for i in 0..n {
cur += 1;
if a[i] == cur {
cur += 1;
}
}
println!("{}", cur);
}

fn main() {
input! {
t: usize
}

for _ in 0..t {
solve();
}
}
```

# [B 题](https://codeforces.com/contest/1882/problem/B)

对于每一个位贪心的求取不到该二进制位时,剩余所有集合的最大并集

```rust
fn solve() {
input! {
n: usize,
}
let mut mask_k = vec![];
let mut hm = HashMap::new();
let mut cnt: u64 = 0;
for _ in 0..n {
input! {
x: usize,
p: [usize; x]
}
let mut mask = 0;
for item in p {
if !hm.contains_key(&item) {
hm.insert(item, cnt);
cnt += 1;
}
mask |= 1 << hm[&item];
}
mask_k.push(mask);
}
let mut res = 0;

for i in 0..cnt {
let mut cur: u64 = 0;
for &mask in &mask_k {
if ((mask >> i) & 1) == 0 {
cur |= mask;
}
}
res = res.max(cur.count_ones());
}
println!("{}", res);
}

fn main() {
input! {
t: usize
}

for _ in 0..t {
solve();
}
}
```
60 changes: 60 additions & 0 deletions docs/codeforces/template.md

Large diffs are not rendered by default.

233 changes: 117 additions & 116 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,125 +6,126 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula');

/** @type {import('@docusaurus/types').Config} */
const config = {
title: '曙光磁铁的算法小站',
tagline: 'Algorithm is cool-算法很酷',
url: 'https://dawnmagnet.github.io',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'DawnMagnet', // Usually your GitHub org/user name.
projectName: 'algorithm-station', // Usually your repo name.
title: '曙光磁铁的算法小站',
tagline: 'Algorithm is cool-算法很酷',
url: 'https://dawnmagnet.github.io',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'DawnMagnet', // Usually your GitHub org/user name.
projectName: 'algorithm-station', // Usually your repo name.

presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
editUrl: 'https://github.com/DawnMagnet/algorithm-station/edit/main/website/',
},
blog: {
showReadingTime: true,
// Please change this to your repo.
editUrl:
'https://github.com/DawnMagnet/algorithm-station/edit/main/website/blog/',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
editUrl: 'https://github.com/DawnMagnet/algorithm-station/edit/main/website/',
},
blog: {
showReadingTime: true,
// Please change this to your repo.
editUrl:
'https://github.com/DawnMagnet/algorithm-station/edit/main/website/blog/',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
],
],
],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
title: '曙光磁铁的算法小站',
logo: {
alt: 'GEa Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'doc',
docId: 'leetcode/intro',
position: 'left',
label: '力扣题解',
},
{
type: 'doc',
docId: 'codeforces/intro',
position: 'left',
label: 'codeforces题解',
},
{
type: 'doc',
docId: 'rcore/summary',
position: 'left',
label: 'rCore学习',
},
{to: '/blog', label: '博客', position: 'left'},
{
href: 'https://github.com/DawnMagnet/algorithm-station',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Tutorial',
to: '/docs/leetcode/intro',
},
],
},
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/docusaurus',
},
{
label: 'Discord',
href: 'https://discordapp.com/invite/docusaurus',
},
{
label: 'Twitter',
href: 'https://twitter.com/docusaurus',
},
],
},
{
title: 'More',
items: [
{
label: 'Blog',
to: '/blog',
},
{
label: 'GitHub',
href: 'https://github.com/DawnMagnet/algorithm-station',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} DawnMagnet, Inc. Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
title: '曙光磁铁的算法小站',
logo: {
alt: 'GEa Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'doc',
docId: 'leetcode/intro',
position: 'left',
label: '力扣题解',
},
{
type: 'doc',
docId: 'codeforces/intro',
position: 'left',
label: 'codeforces题解',
},
{
type: 'doc',
docId: 'rcore/summary',
position: 'left',
label: 'rCore学习',
},
{ to: '/blog', label: '博客', position: 'left' },
{
href: 'https://github.com/DawnMagnet/algorithm-station',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Tutorial',
to: '/docs/leetcode/intro',
},
],
},
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/docusaurus',
},
{
label: 'Discord',
href: 'https://discordapp.com/invite/docusaurus',
},
{
label: 'Twitter',
href: 'https://twitter.com/docusaurus',
},
],
},
{
title: 'More',
items: [
{
label: 'Blog',
to: '/blog',
},
{
label: 'GitHub',
href: 'https://github.com/DawnMagnet/algorithm-station',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} DawnMagnet, Inc. Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ['rust']
},
}),
};

module.exports = config;
6 changes: 1 addition & 5 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ const sidebars = {
{
type: 'category',
label: 'Codeforces',
items: [{
type: 'doc',
id: 'codeforces/intro',
label: 'CodeForces主页'
}],
items: [{type: 'autogenerated', dirName: 'codeforces'}],
},
{
type: 'category',
Expand Down
19 changes: 19 additions & 0 deletions src/theme/prism-include-languages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import siteConfig from '@generated/docusaurus.config';
export default function prismIncludeLanguages(PrismObject) {
const {
themeConfig: { prism },
} = siteConfig;
const { additionalLanguages } = prism;
// Prism components work on the Prism instance on the window, while prism-
// react-renderer uses its own Prism instance. We temporarily mount the
// instance onto window, import components to enhance it, then remove it to
// avoid polluting global namespace.
// You can mutate PrismObject: registering plugins, deleting languages... As
// long as you don't re-assign it
globalThis.Prism = PrismObject;
additionalLanguages.forEach((lang) => {
// eslint-disable-next-line global-require, import/no-dynamic-require
require(`prismjs/components/prism-${lang}`);
});
delete globalThis.Prism;
}
Loading

0 comments on commit 377e683

Please sign in to comment.