Skip to content

Commit 05f0496

Browse files
committed
Solve D in abc167
1 parent 2a47965 commit 05f0496

File tree

14 files changed

+1020
-0
lines changed

14 files changed

+1020
-0
lines changed

atcoder/rust/abc167/Cargo.lock

Lines changed: 638 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

atcoder/rust/abc167/Cargo.toml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
[package]
2+
name = "abc167"
3+
version = "0.1.0"
4+
authors = ["k-yomo <kanji.yy@gmail.com>"]
5+
edition = "2018"
6+
7+
[package.metadata.cargo-compete]
8+
config = "../compete.toml"
9+
10+
[package.metadata.cargo-compete.bin]
11+
a = { name = "abc167-a", problem = { platform = "atcoder", contest = "abc167", index = "A", url = "https://atcoder.jp/contests/abc167/tasks/abc167_a" } }
12+
b = { name = "abc167-b", problem = { platform = "atcoder", contest = "abc167", index = "B", url = "https://atcoder.jp/contests/abc167/tasks/abc167_b" } }
13+
c = { name = "abc167-c", problem = { platform = "atcoder", contest = "abc167", index = "C", url = "https://atcoder.jp/contests/abc167/tasks/abc167_c" } }
14+
d = { name = "abc167-d", problem = { platform = "atcoder", contest = "abc167", index = "D", url = "https://atcoder.jp/contests/abc167/tasks/abc167_d" } }
15+
e = { name = "abc167-e", problem = { platform = "atcoder", contest = "abc167", index = "E", url = "https://atcoder.jp/contests/abc167/tasks/abc167_e" } }
16+
f = { name = "abc167-f", problem = { platform = "atcoder", contest = "abc167", index = "F", url = "https://atcoder.jp/contests/abc167/tasks/abc167_f" } }
17+
18+
[[bin]]
19+
name = "abc167-a"
20+
path = "src/bin/a.rs"
21+
22+
[[bin]]
23+
name = "abc167-b"
24+
path = "src/bin/b.rs"
25+
26+
[[bin]]
27+
name = "abc167-c"
28+
path = "src/bin/c.rs"
29+
30+
[[bin]]
31+
name = "abc167-d"
32+
path = "src/bin/d.rs"
33+
34+
[[bin]]
35+
name = "abc167-e"
36+
path = "src/bin/e.rs"
37+
38+
[[bin]]
39+
name = "abc167-f"
40+
path = "src/bin/f.rs"
41+
[dependencies]
42+
num = "=0.2.1"
43+
num-bigint = "=0.2.6"
44+
num-complex = "=0.2.4"
45+
num-integer = "=0.1.42"
46+
num-iter = "=0.1.40"
47+
num-rational = "=0.2.4"
48+
num-traits = "=0.2.11"
49+
num-derive = "=0.3.0"
50+
ndarray = "=0.13.0"
51+
nalgebra = "=0.20.0"
52+
alga = "=0.9.3"
53+
libm = "=0.2.1"
54+
rand = { version = "=0.7.3", features = ["small_rng"] }
55+
getrandom = "=0.1.14"
56+
rand_chacha = "=0.2.2"
57+
rand_core = "=0.5.1"
58+
rand_hc = "=0.2.0"
59+
rand_pcg = "=0.2.1"
60+
rand_distr = "=0.2.2"
61+
petgraph = "=0.5.0"
62+
indexmap = "=1.3.2"
63+
regex = "=1.3.6"
64+
lazy_static = "=1.4.0"
65+
ordered-float = "=1.0.2"
66+
ascii = "=1.0.0"
67+
permutohedron = "=0.2.4"
68+
superslice = "=1.0.0"
69+
itertools = "=0.9.0"
70+
itertools-num = "=0.1.3"
71+
maplit = "=1.0.2"
72+
either = "=1.5.3"
73+
im-rc = "=14.3.0"
74+
fixedbitset = "=0.2.0"
75+
bitset-fixed = "=0.1.0"
76+
proconio = { version = "=0.3.6", features = ["derive"] }
77+
text_io = "=0.1.8"
78+
whiteread = "=0.5.0"
79+
rustc-hash = "=1.1.0"
80+
smallvec = "=1.2.0"

atcoder/rust/abc167/src/bin/a.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![allow(unused_imports)]
2+
3+
use std::cmp::*;
4+
use std::collections::*;
5+
use std::io::Write;
6+
use std::ops::Bound::*;
7+
8+
use itertools::*;
9+
use itertools::__std_iter::once;
10+
use itertools_num::ItertoolsNum;
11+
use proconio::*;
12+
use proconio::marker::*;
13+
use superslice::*;
14+
15+
fn main() {
16+
input! {
17+
18+
}
19+
}

atcoder/rust/abc167/src/bin/b.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![allow(unused_imports)]
2+
3+
use std::cmp::*;
4+
use std::collections::*;
5+
use std::io::Write;
6+
use std::ops::Bound::*;
7+
8+
use itertools::*;
9+
use itertools::__std_iter::once;
10+
use itertools_num::ItertoolsNum;
11+
use proconio::*;
12+
use proconio::marker::*;
13+
use superslice::*;
14+
15+
fn main() {
16+
input! {
17+
18+
}
19+
}

atcoder/rust/abc167/src/bin/c.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![allow(unused_imports)]
2+
3+
use std::cmp::*;
4+
use std::collections::*;
5+
use std::io::Write;
6+
use std::ops::Bound::*;
7+
8+
use itertools::*;
9+
use itertools::__std_iter::once;
10+
use itertools_num::ItertoolsNum;
11+
use proconio::*;
12+
use proconio::marker::*;
13+
use superslice::*;
14+
15+
fn main() {
16+
input! {
17+
18+
}
19+
}

atcoder/rust/abc167/src/bin/d.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#![allow(unused_imports)]
2+
3+
use std::cmp::*;
4+
use std::collections::*;
5+
use std::io::Write;
6+
use std::ops::Bound::*;
7+
8+
use itertools::*;
9+
use itertools::__std_iter::once;
10+
use itertools_num::ItertoolsNum;
11+
use proconio::*;
12+
use proconio::marker::*;
13+
use superslice::*;
14+
15+
fn main() {
16+
input! {
17+
n: usize, k: usize,
18+
a: [usize; n],
19+
}
20+
21+
let mut cur_town = 1;
22+
let mut count = 0;
23+
let mut visited = HashMap::new();
24+
while *visited.get(&cur_town).unwrap_or(&0) == 0 {
25+
visited.insert(cur_town, count);
26+
cur_town = a[cur_town - 1];
27+
count += 1;
28+
if count == k {
29+
return println!("{}", cur_town);
30+
}
31+
}
32+
33+
let k_rest = (k - count) % (count - *visited.get(&cur_town).unwrap());
34+
for _ in 0..k_rest {
35+
cur_town = a[cur_town - 1];
36+
}
37+
38+
println!("{}", cur_town);
39+
}

atcoder/rust/abc167/src/bin/e.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![allow(unused_imports)]
2+
3+
use std::cmp::*;
4+
use std::collections::*;
5+
use std::io::Write;
6+
use std::ops::Bound::*;
7+
8+
use itertools::*;
9+
use itertools::__std_iter::once;
10+
use itertools_num::ItertoolsNum;
11+
use proconio::*;
12+
use proconio::marker::*;
13+
use superslice::*;
14+
15+
fn main() {
16+
input! {
17+
18+
}
19+
}

atcoder/rust/abc167/src/bin/f.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![allow(unused_imports)]
2+
3+
use std::cmp::*;
4+
use std::collections::*;
5+
use std::io::Write;
6+
use std::ops::Bound::*;
7+
8+
use itertools::*;
9+
use itertools::__std_iter::once;
10+
use itertools_num::ItertoolsNum;
11+
use proconio::*;
12+
use proconio::marker::*;
13+
use superslice::*;
14+
15+
fn main() {
16+
input! {
17+
18+
}
19+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
type: Batch
3+
timelimit: 2s
4+
match: Lines
5+
6+
cases:
7+
- name: sample1
8+
in: |
9+
chokudai
10+
chokudaiz
11+
out: |
12+
Yes
13+
- name: sample2
14+
in: |
15+
snuke
16+
snekee
17+
out: |
18+
No
19+
- name: sample3
20+
in: |
21+
a
22+
aa
23+
out: |
24+
Yes
25+
26+
extend: []
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
type: Batch
3+
timelimit: 2s
4+
match: Lines
5+
6+
cases:
7+
- name: sample1
8+
in: |
9+
2 1 1 3
10+
out: |
11+
2
12+
- name: sample2
13+
in: |
14+
1 2 3 4
15+
out: |
16+
0
17+
- name: sample3
18+
in: |
19+
2000000000 0 0 2000000000
20+
out: |
21+
2000000000
22+
23+
extend: []

0 commit comments

Comments
 (0)