Skip to content

Commit 44162ae

Browse files
authored
Merge pull request rust-lang-ja#34 from qryxip/ja-all-enabled-add-commented-out-code-to-make-proconio-removable
Add commented out code to make `proconio` removable
2 parents 6017df8 + 03afd04 commit 44162ae

13 files changed

+180
-7
lines changed

examples/abc120-d.rs

+30-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
11
// https://atcoder.jp/contests/abc120/tasks/abc120_d
22

3-
use proconio::marker::Usize1;
4-
use proconio::{fastout, input};
53
use union_find::{QuickFindUf, UnionBySize, UnionFind as _};
64

7-
#[fastout]
5+
#[proconio::fastout]
86
fn main() {
7+
// use std::io::{self, Read as _};
8+
//
9+
// let mut input = "".to_owned();
10+
// io::stdin().read_to_string(&mut input).unwrap();
11+
// let mut input = input.split_whitespace();
12+
// macro_rules! read {
13+
// ([$t:tt; $n:expr]) => {
14+
// (0..$n).map(|_| read!($t)).collect::<Vec<_>>()
15+
// };
16+
// (($($t:tt),+)) => {
17+
// ($(read!($t)),*)
18+
// };
19+
// (_1based) => {
20+
// read!(usize) - 1
21+
// };
22+
// (_bytes) => {
23+
// read!(String).into_bytes()
24+
// };
25+
// ($ty:ty) => {
26+
// input.next().unwrap().parse::<$ty>().unwrap()
27+
// };
28+
// }
29+
//
30+
// let (n, m) = (read!((usize, usize)));
31+
// let abs = read!([(_1based, _1based); m]);
32+
33+
use proconio::input;
34+
use proconio::marker::Usize1;
35+
936
input! {
1037
n: usize,
1138
m: usize,

examples/apg4b-a.rs

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ use strsim as _;
5252
use superslice as _;
5353
use take_mut as _;
5454
use text_io as _;
55+
use union_find as _;
5556
use whiteread as _;
5657

5758
#[cfg(feature = "jemalloc-ctl")]

examples/arc065-c.rs

+29-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
11
// https://atcoder.jp/contests/arc065/tasks/arc065_a
22

33
use lazy_static::lazy_static;
4-
use proconio::input;
5-
use proconio::marker::Bytes;
64
use regex::bytes::Regex;
75

6+
#[proconio::fastout]
87
fn main() {
8+
// use std::io::{self, Read as _};
9+
//
10+
// let mut input = "".to_owned();
11+
// io::stdin().read_to_string(&mut input).unwrap();
12+
// let mut input = input.split_whitespace();
13+
// macro_rules! read {
14+
// ([$t:tt; $n:expr]) => {
15+
// (0..$n).map(|_| read!($t)).collect::<Vec<_>>()
16+
// };
17+
// (($($t:tt),+)) => {
18+
// ($(read!($t)),*)
19+
// };
20+
// (_1based) => {
21+
// read!(usize) - 1
22+
// };
23+
// (_bytes) => {
24+
// read!(String).into_bytes()
25+
// };
26+
// ($ty:ty) => {
27+
// input.next().unwrap().parse::<$ty>().unwrap()
28+
// };
29+
// }
30+
//
31+
// let s = read!(_bytes);
32+
33+
use proconio::input;
34+
use proconio::marker::Bytes;
35+
936
input! {
1037
s: Bytes,
1138
}

examples/atc001-b.rs

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
use petgraph::unionfind::UnionFind;
2+
3+
#[proconio::fastout]
4+
fn main() {
5+
// use std::io::{self, Read as _};
6+
//
7+
// let mut input = "".to_owned();
8+
// io::stdin().read_to_string(&mut input).unwrap();
9+
// let mut input = input.split_whitespace();
10+
// macro_rules! read {
11+
// ([$t:tt; $n:expr]) => {
12+
// (0..$n).map(|_| read!($t)).collect::<Vec<_>>()
13+
// };
14+
// (($($t:tt),+)) => {
15+
// ($(read!($t)),*)
16+
// };
17+
// (_1based) => {
18+
// read!(usize) - 1
19+
// };
20+
// (_bytes) => {
21+
// read!(String).into_bytes()
22+
// };
23+
// ($ty:ty) => {
24+
// input.next().unwrap().parse::<$ty>().unwrap()
25+
// };
26+
// }
27+
//
28+
// let (n, q) = read!((usize, usize));
29+
// let pabs = read!([(u8, usize, usize); q]);
30+
31+
use proconio::input;
32+
33+
input! {
34+
n: usize,
35+
q: usize,
36+
pabs: [(u8, usize, usize); q],
37+
}
38+
39+
let mut uf = UnionFind::new(n);
40+
for (p, a, b) in pabs {
41+
if p == 1 {
42+
let same = uf.find(a) == uf.find(b);
43+
println!("{}", if same { "Yes" } else { "No" });
44+
} else {
45+
uf.union(a, b);
46+
}
47+
}
48+
}

examples/atc002-b.rs

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// https://atcoder.jp/contests/atc002/tasks/atc002_b
2+
3+
use num::BigUint;
4+
5+
#[proconio::fastout]
6+
fn main() {
7+
// use defmac::defmac;
8+
//
9+
// use std::io::{self, Read as _};
10+
//
11+
// let mut input = "".to_owned();
12+
// io::stdin().read_to_string(&mut input).unwrap();
13+
// let mut input = input.split_whitespace();
14+
// defmac!(read => input.next().unwrap().parse().unwrap());
15+
//
16+
// let n: BigUint = read!();
17+
// let m: BigUint = read!();
18+
// let p: BigUint = read!();
19+
20+
use proconio::input;
21+
22+
input! {
23+
n: BigUint,
24+
m: BigUint,
25+
p: BigUint,
26+
}
27+
28+
println!("{}", n.modpow(&p, &m));
29+
}

examples/practice-a.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
// https://atcoder.jp/contests/practice/tasks/practice_1
22

3-
use proconio::input;
4-
3+
#[proconio::fastout]
54
fn main() {
5+
// use defmac::defmac;
6+
//
7+
// use std::io::{self, Read as _};
8+
//
9+
// let mut input = "".to_owned();
10+
// io::stdin().read_to_string(&mut input).unwrap();
11+
// let mut input = input.split_whitespace();
12+
// defmac!(read => input.next().unwrap().parse().unwrap());
13+
//
14+
// let (a, b, c, s): (u32, u32, u32, String) = (read!(), read!(), read!(), read!());
15+
16+
use proconio::input;
17+
618
input! {
719
a: u32,
820
b: u32,

examples/tests.ron

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// 手元でDropboxのテストケース(ある場合)で確認し、Gitに含めるのはそのうちサンプルのみ。
2+
// CI上でもサンプルだけテストする。(Dropboxから引っ張るのも面倒だし何より誰のアカウントを使うかという問題がある)
3+
14
(
25
tests: {
36
"apg4b-a": (
@@ -8,6 +11,14 @@
811
name: "practice contest: A - Welcome to AtCoder",
912
matching: ExactWords,
1013
),
14+
"atc001-b": (
15+
name: "ATC001: B - Union Find",
16+
matching: ExactWords,
17+
),
18+
"atc002-b": (
19+
name: "ATC002: B - n^p mod m",
20+
matching: ExactWords,
21+
),
1122
"arc065-c": (
1223
name: "ABC049 / ARC065: C - 白昼夢 / Daydream",
1324
matching: ExactWords,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
8 9
2+
0 1 2
3+
0 3 2
4+
1 1 3
5+
1 1 4
6+
0 2 4
7+
1 4 1
8+
0 4 2
9+
0 0 0
10+
1 0 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Yes
2+
No
3+
Yes
4+
Yes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
12 15 7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
123456789 234567894 6574837563712
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
120678297

0 commit comments

Comments
 (0)