Skip to content

Commit 39026b7

Browse files
committed
Add a test for ABC118-B
1 parent 2ae70cc commit 39026b7

File tree

8 files changed

+42
-0
lines changed

8 files changed

+42
-0
lines changed

examples/abc118-b.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// https://atcoder.jp/contests/abc118/tasks/abc118_b
2+
3+
use whiteread::Reader;
4+
5+
use std::ops::{BitAnd, BitOr};
6+
7+
fn main() {
8+
let mut rdr = Reader::from_stdin_naive();
9+
let (n, _) = rdr.p::<(usize, usize)>();
10+
let a = (0..n)
11+
.map(|_| {
12+
let k = rdr.p::<usize>();
13+
(0..k).map(|_| rdr.p::<usize>() - 1).collect()
14+
})
15+
.collect::<Vec<Vec<_>>>();
16+
17+
let ans = a
18+
.into_iter()
19+
.map(|row| row.into_iter().map(|k| 1 << k).fold(0, BitOr::bitor))
20+
.fold(usize::max_value(), BitAnd::bitand)
21+
.count_ones();
22+
println!("{}", ans);
23+
}

examples/tests.ron

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
name: "ABC084: D - 2017-like Number",
4848
matching: Words,
4949
),
50+
"abc118-b": (
51+
name: "ABC118: B - Foods Loved by Everyone",
52+
matching: Words,
53+
),
5054
"abc120-d": (
5155
name: "ABC120: D - Decayed Bridges",
5256
matching: Words,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
3 4
2+
2 1 3
3+
3 1 2 3
4+
2 3 2
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
5 5
2+
4 2 3 4 5
3+
4 1 3 4 5
4+
4 1 2 4 5
5+
4 1 2 3 5
6+
4 1 2 3 4
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1 30
2+
3 5 10 30
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy