Skip to content

Commit 91f7c8b

Browse files
committed
Solve C in abc257
1 parent 9b42d13 commit 91f7c8b

File tree

16 files changed

+1056
-0
lines changed

16 files changed

+1056
-0
lines changed

atcoder/rust/abc257/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/abc257/Cargo.toml

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

atcoder/rust/abc257/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/abc257/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/abc257/src/bin/c.rs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
#[macro_export]
16+
macro_rules! chmax {($ base : expr , $ ($ cmps : expr ) ,+ $ (, ) * ) => {{let cmp_max = max ! ($ ($ cmps ) ,+ ) ; if $ base < cmp_max {$ base = cmp_max ; true } else {false } } } ; }
17+
#[macro_export]
18+
macro_rules! max {($ a : expr $ (, ) * ) => {{$ a } } ; ($ a : expr , $ b : expr $ (, ) * ) => {{std :: cmp :: max ($ a , $ b ) } } ; ($ a : expr , $ ($ rest : expr ) ,+ $ (, ) * ) => {{std :: cmp :: max ($ a , max ! ($ ($ rest ) ,+ ) ) } } ; }
19+
20+
fn main() {
21+
input! {
22+
n: usize,
23+
s: Chars,
24+
w: [usize; n],
25+
}
26+
27+
let mut children = vec![];
28+
let mut adults = vec![];
29+
for (i, flag) in s.iter().enumerate() {
30+
match flag {
31+
&'0' => children.push(w[i]),
32+
&'1' => adults.push(w[i]),
33+
_ => {},
34+
}
35+
}
36+
37+
children.sort();
38+
adults.sort();
39+
40+
let mut max_correct_count = 0;
41+
for (i, size) in adults.iter().enumerate() {
42+
chmax!(max_correct_count, (adults.len() - i - 1) + children.lower_bound(size) + 1);
43+
}
44+
if adults.len() == 0 {
45+
max_correct_count = children.len()
46+
}
47+
println!("{}", max_correct_count);
48+
}
49+

atcoder/rust/abc257/src/bin/d.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/abc257/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/abc257/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+
}

atcoder/rust/abc257/src/bin/g.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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
type: Batch
3+
timelimit: 2s
4+
match: Lines
5+
6+
cases:
7+
- name: sample1
8+
in: |
9+
1 3
10+
out: |
11+
C
12+
- name: sample2
13+
in: |
14+
2 12
15+
out: |
16+
F
17+
18+
extend: []

0 commit comments

Comments
 (0)