@@ -29,33 +29,41 @@ fn main() -> UnitResult {
29
29
// https://atcoder.jp/contests/abs/fasks/arc089_a
30
30
31
31
// proconio
32
- #[ proconio:: fastout]
33
32
fn run_proconio ( ) {
34
- use proconio:: input ;
35
- use proconio :: source :: auto :: AutoSource ;
33
+ use proconio:: source :: { line :: LineSource , once :: OnceSource , Source } ;
34
+ use std :: io :: BufReader ;
36
35
37
- let source = AutoSource :: from (
38
- r#"2
36
+ run_proconio_for :: < OnceSource < BufReader < & [ u8 ] > > > ( ) ;
37
+ run_proconio_for :: < LineSource < BufReader < & [ u8 ] > > > ( ) ;
38
+
39
+ #[ proconio:: fastout]
40
+ fn run_proconio_for < ' a , T : Source < BufReader < & ' a [ u8 ] > > + From < & ' a str > > ( ) {
41
+ use proconio:: input;
42
+
43
+ let source = T :: from (
44
+ r#"2
39
45
3 1 2
40
46
6 1 1
41
47
"# ,
42
- ) ;
43
-
44
- input ! {
45
- from source,
46
- n: usize ,
47
- mut plan: [ ( i32 , i32 , i32 ) ; n] , // Vec<(i32, i32, i32)>
48
+ ) ;
49
+
50
+ input ! {
51
+ from source,
52
+ n: usize ,
53
+ mut plan: [ ( i32 , i32 , i32 ) ; n] , // Vec<(i32, i32, i32)>
54
+ }
55
+
56
+ plan. insert ( 0 , ( 0 , 0 , 0 ) ) ;
57
+ let yes = plan. windows ( 2 ) . all ( |w| {
58
+ let ( t0, x0, y0) = w[ 0 ] ;
59
+ let ( t1, x1, y1) = w[ 1 ] ;
60
+ let time = t1 - t0;
61
+ let dist = ( x1 - x0) . abs ( ) + ( y1 - y0) . abs ( ) ;
62
+ dist <= time && time % 2 == dist % 2
63
+ } ) ;
64
+ println ! ( "{}" , if yes { "Yes" } else { "No" } ) ;
65
+ assert ! ( yes) ;
48
66
}
49
- plan. insert ( 0 , ( 0 , 0 , 0 ) ) ;
50
- let yes = plan. windows ( 2 ) . all ( |w| {
51
- let ( t0, x0, y0) = w[ 0 ] ;
52
- let ( t1, x1, y1) = w[ 1 ] ;
53
- let time = t1 - t0;
54
- let dist = ( x1 - x0) . abs ( ) + ( y1 - y0) . abs ( ) ;
55
- dist <= time && time % 2 == dist % 2
56
- } ) ;
57
- println ! ( "{}" , if yes { "Yes" } else { "No" } ) ;
58
- assert ! ( yes) ;
59
67
}
60
68
61
69
#[ test]
0 commit comments