-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
DawnMagnet
committed
Sep 26, 2023
1 parent
6cac28c
commit 377e683
Showing
6 changed files
with
2,108 additions
and
1,903 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
``` |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Oops, something went wrong.