File tree 8 files changed +42
-26
lines changed
8 files changed +42
-26
lines changed Original file line number Diff line number Diff line change
1
+ use proconio:: marker:: * ;
2
+ use proconio:: * ;
3
+ pub fn main ( ) {
4
+ input ! {
5
+ n: usize ,
6
+ a: [ usize ; n]
7
+ }
8
+ let mut b = a. clone ( ) ;
9
+ b. sort ( ) ;
10
+ b. dedup ( ) ;
11
+
12
+ let res = a
13
+ . iter ( )
14
+ . map ( |& x| b. binary_search ( & x) . unwrap ( ) )
15
+ . for_each ( |x| println ! ( "{}" , x) ) ;
16
+ }
Original file line number Diff line number Diff line change @@ -2,18 +2,18 @@ use proconio::input;
2
2
use proconio:: marker:: Chars ;
3
3
fn main ( ) {
4
4
input ! {
5
- S : Chars ,
6
- T : Chars ,
5
+ s : Chars ,
6
+ t : Chars ,
7
7
}
8
8
let mut start = !0 ;
9
- if S . len ( ) < T . len ( ) {
9
+ if s . len ( ) < t . len ( ) {
10
10
println ! ( "UNRESTORABLE" ) ;
11
11
return ;
12
12
}
13
- for i in 0 ..=S . len ( ) - T . len ( ) {
13
+ for i in 0 ..=s . len ( ) - t . len ( ) {
14
14
let mut flg = true ;
15
- for j in 0 ..T . len ( ) {
16
- if S [ i + j] != '?' && S [ i + j] != T [ j] {
15
+ for j in 0 ..t . len ( ) {
16
+ if s [ i + j] != '?' && s [ i + j] != t [ j] {
17
17
flg = false ;
18
18
break ;
19
19
}
@@ -26,11 +26,11 @@ fn main() {
26
26
println ! ( "UNRESTORABLE" ) ;
27
27
return ;
28
28
}
29
- let mut ans = S
29
+ let mut ans = s
30
30
. iter ( )
31
31
. map ( |& x| if x == '?' { 'a' } else { x } )
32
32
. collect :: < Vec < char > > ( ) ;
33
- for ( ix, c) in T . iter ( ) . enumerate ( ) {
33
+ for ( ix, c) in t . iter ( ) . enumerate ( ) {
34
34
ans[ start + ix] = * c;
35
35
}
36
36
println ! ( "{}" , ans. into_iter( ) . collect:: <String >( ) ) ;
Original file line number Diff line number Diff line change @@ -27,19 +27,19 @@ pub fn main() {
27
27
}
28
28
let cnt = abc[ 1 ] + i;
29
29
if cnt == 1 {
30
- res += 1 * aCb ( abc[ 2 ] , i)
30
+ res += 1 * acb ( abc[ 2 ] , i)
31
31
} else if cnt == 2 {
32
- res += ( 2 * 4 + aCb ( 4 , 2 ) ) * aCb ( abc[ 2 ] , i)
32
+ res += ( 2 * 4 + acb ( 4 , 2 ) ) * acb ( abc[ 2 ] , i)
33
33
} else if cnt == 3 {
34
- res += 3 * 4 * 3 * aCb ( abc[ 2 ] , i)
34
+ res += 3 * 4 * 3 * acb ( abc[ 2 ] , i)
35
35
} else if cnt == 4 {
36
- res += 4 * 3 * 2 * aCb ( abc[ 2 ] , i)
36
+ res += 4 * 3 * 2 * acb ( abc[ 2 ] , i)
37
37
} ;
38
38
}
39
39
println ! ( "{}" , res) ;
40
40
}
41
41
42
- fn aCb ( a : usize , b : usize ) -> usize {
42
+ fn acb ( a : usize , b : usize ) -> usize {
43
43
let mut res = 1 ;
44
44
for i in 0 ..b {
45
45
res *= a - i;
Original file line number Diff line number Diff line change @@ -9,20 +9,20 @@ pub fn main() {
9
9
n: usize ,
10
10
a: [ usize ; n]
11
11
}
12
- let MOD = 998244353 ;
12
+ let modulo = 998244353 ;
13
13
let mut dp = vec ! [ vec![ 0 ; 10 ] ; n] ;
14
14
dp[ 0 ] [ a[ 0 ] ] = 1 ;
15
15
for i in 1 ..n {
16
16
for j in 0 ..10 {
17
17
let f = ( j + a[ i] ) % 10 ;
18
18
let g = ( j * a[ i] ) % 10 ;
19
19
dp[ i] [ f] += dp[ i - 1 ] [ j] ;
20
- dp[ i] [ f] %= MOD ;
20
+ dp[ i] [ f] %= modulo ;
21
21
dp[ i] [ g] += dp[ i - 1 ] [ j] ;
22
- dp[ i] [ g] %= MOD ;
22
+ dp[ i] [ g] %= modulo ;
23
23
}
24
24
}
25
25
for i in 0 ..10 {
26
- println ! ( "{}" , dp[ n - 1 ] [ i] % MOD ) ;
26
+ println ! ( "{}" , dp[ n - 1 ] [ i] % modulo ) ;
27
27
}
28
28
}
Original file line number Diff line number Diff line change @@ -11,20 +11,20 @@ pub fn main() {
11
11
k: usize
12
12
}
13
13
let mut res = 0 ;
14
- let MOD = 998244353 ;
14
+ let modulo = 998244353 ;
15
15
let mut dp = vec ! [ vec![ 0 ; 3010 ] ; 51 ] ;
16
16
dp[ 0 ] [ 0 ] = 1 ;
17
17
for i in 0 ..n {
18
18
for j in 0 ..=k {
19
19
for l in 1 ..=m {
20
- dp[ i + 1 ] [ j + l] += dp[ i] [ j] % MOD ;
21
- dp[ i + 1 ] [ j + l] %= MOD ;
20
+ dp[ i + 1 ] [ j + l] += dp[ i] [ j] % modulo ;
21
+ dp[ i + 1 ] [ j + l] %= modulo ;
22
22
}
23
23
}
24
24
}
25
25
for i in n..=k {
26
- res += dp[ n] [ i] % MOD ;
27
- res %= MOD ;
26
+ res += dp[ n] [ i] % modulo ;
27
+ res %= modulo ;
28
28
}
29
- println ! ( "{}" , res % MOD ) ;
29
+ println ! ( "{}" , res % modulo ) ;
30
30
}
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ pub fn main() {
15
15
for i in 0 ..n {
16
16
let ( a, b) = ab[ i] ;
17
17
for j in 0 ..=s {
18
- if ( dp[ i] [ j] ) {
18
+ if dp[ i] [ j] {
19
19
if j + a <= s {
20
20
dp[ i + 1 ] [ j + a] = true ;
21
21
}
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ mod abc017;
10
10
mod abc019;
11
11
mod abc027;
12
12
mod abc035;
13
+ mod abc036;
13
14
mod abc039;
14
15
mod abc040;
15
16
mod abc048;
@@ -95,5 +96,5 @@ mod agc019;
95
96
mod arc142;
96
97
mod pa_ken2019;
97
98
fn main ( ) {
98
- abc151 :: main ( ) ;
99
+ abc036 :: main ( ) ;
99
100
}
Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ fn i() {
48
48
for i in ( n / 2 + 1 ) ..n + 1 {
49
49
ans += dp[ n] [ i] ;
50
50
}
51
- println ! ( "{:?}" , dp) ;
52
51
println ! ( "{}" , ans) ;
53
52
}
54
53
You can’t perform that action at this time.
0 commit comments