Skip to content

Commit 3823bf1

Browse files
committed
Modify read!s
1 parent 39208de commit 3823bf1

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

examples/abc054-c.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ use std::io::{self, Read};
77
fn main() {
88
let mut input = read_to_static(io::stdin()).split_whitespace();
99
macro_rules! read {
10-
(_1based) => {
11-
read!(usize) - 1
12-
};
1310
([$tt:tt]) => (read!([$tt; read!(usize)]));
1411
([$tt:tt; $n:expr]) => ((0..$n).map(|_| read!($tt)).collect::<Vec<_>>());
1512
(($($tt:tt),+)) => (($(read!($tt)),*));
1613
($ty:ty) => (input.next().unwrap().parse::<$ty>().unwrap());
14+
({ Usize1 }) => {
15+
read!(usize) - 1
16+
};
1717
}
1818

1919
let n = read!(usize);
20-
let abs = read!([(_1based, _1based)]);
20+
let abs = read!([({ Usize1 }, { Usize1 })]);
2121

2222
let graph = UnMatrix::<(), (), Option<()>, usize>::from_edges(abs);
2323
let mut ans = 0;

examples/abc118-b-naive.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ use std::ops::{BitAnd, BitOr};
66
fn main() {
77
let mut input = read_to_static(io::stdin()).split_whitespace();
88
macro_rules! read {
9-
(_1based) => {
10-
read!(usize) - 1
11-
};
129
([$tt:tt]) => (read!([$tt; read!(usize)]));
1310
([$tt:tt; $n:expr]) => ((0..$n).map(|_| read!($tt)).collect::<Vec<_>>());
1411
(($($tt:tt),+)) => (($(read!($tt)),*));
1512
($ty:ty) => (input.next().unwrap().parse::<$ty>().unwrap());
13+
({ Usize1 }) => {
14+
read!(usize) - 1
15+
};
1616
}
1717

1818
let (n, _) = read!((usize, usize));
19-
let a = read!([[_1based]; n]);
19+
let a = read!([[{ Usize1 }]; n]);
2020

2121
let ans = a
2222
.into_iter()

examples/abc120-d.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ use std::io::{self, BufWriter, Read, StdoutLock, Write as _};
77
fn main() {
88
let mut input = read_to_static(io::stdin()).split_whitespace();
99
macro_rules! read {
10-
(_1based) => {
11-
read!(usize) - 1
12-
};
1310
([$tt:tt]) => (read!([$tt; read!(usize)]));
1411
([$tt:tt; $n:expr]) => ((0..$n).map(|_| read!($tt)).collect::<Vec<_>>());
1512
(($($tt:tt),+)) => (($(read!($tt)),*));
1613
($ty:ty) => (input.next().unwrap().parse::<$ty>().unwrap());
14+
({ Usize1 }) => {
15+
read!(usize) - 1
16+
};
1717
}
1818

1919
let n = read!(usize);
20-
let abs = read!([(_1based, _1based)]);
20+
let abs = read!([({ Usize1 }, { Usize1 })]);
2121

2222
let max = n * (n - 1) / 2;
2323
let mut uf = QuickFindUf::<UnionBySize>::new(n);

examples/abc151-d.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ use std::iter;
1010
fn main() {
1111
let mut input = read_to_static(io::stdin()).split_whitespace();
1212
macro_rules! read {
13-
(_maze<$c:literal, ($h:expr, $w:expr)>) => {
13+
([$tt:tt]) => (read!([$tt; read!(usize)]));
14+
([$tt:tt; $n:expr]) => ((0..$n).map(|_| read!($tt)).collect::<Vec<_>>());
15+
(($($tt:tt),+)) => (($(read!($tt)),*));
16+
($ty:ty) => (input.next().unwrap().parse::<$ty>().unwrap());
17+
({ Maze<$c:literal, ($h:expr, $w:expr)> }) => {
1418
Array::from_shape_vec(
1519
($h, $w),
1620
(0..$h)
@@ -21,14 +25,10 @@ fn main() {
2125
)
2226
.unwrap()
2327
};
24-
([$tt:tt]) => (read!([$tt; read!(usize)]));
25-
([$tt:tt; $n:expr]) => ((0..$n).map(|_| read!($tt)).collect::<Vec<_>>());
26-
(($($tt:tt),+)) => (($(read!($tt)),*));
27-
($ty:ty) => (input.next().unwrap().parse::<$ty>().unwrap());
2828
}
2929

3030
let (h, w) = read!((usize, usize));
31-
let maze = read!(_maze<b'.', (h, w)>);
31+
let maze = read!({ Maze<b'.', (h, w)> });
3232

3333
let neighbors = Array::from_shape_fn((h, w), |(i, j)| -> SmallVec<[_; 4]> {
3434
let mut neighbors = smallvec![];

examples/arc065-c.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ use std::io::{self, Read};
88
fn main() {
99
let mut input = read_to_static(io::stdin()).split_whitespace();
1010
macro_rules! read {
11-
(_bytes) => {
12-
read!(String).into_bytes()
13-
};
1411
([$tt:tt]) => (read!([$tt; read!(usize)]));
1512
([$tt:tt; $n:expr]) => ((0..$n).map(|_| read!($tt)).collect::<Vec<_>>());
1613
(($($tt:tt),+)) => (($(read!($tt)),*));
1714
($ty:ty) => (input.next().unwrap().parse::<$ty>().unwrap());
15+
({ Bytes }) => {
16+
read!(String).into_bytes()
17+
};
1818
}
1919

20-
let s = read!(_bytes);
20+
let s = read!({ Bytes });
2121

2222
lazy_static! {
2323
static ref R: Regex = Regex::new(r"\A(dream(er)?|eraser?)*\z").unwrap();

0 commit comments

Comments
 (0)