File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "bufio"
5
+ . "fmt"
6
+ "io"
7
+ )
8
+
9
+ // github.com/EndlessCheng/codeforces-go
10
+ func CF1600E (_r io.Reader , out io.Writer ) {
11
+ in := bufio .NewReader (_r )
12
+ var n int
13
+ Fscan (in , & n )
14
+ a := make ([]int , n )
15
+ for i := range a {
16
+ Fscan (in , & a [i ])
17
+ }
18
+
19
+ p , q := 1 , n - 1
20
+ for ; p < n && a [p - 1 ] < a [p ]; p ++ {}
21
+ for ; q > 0 && a [q ] < a [q - 1 ]; q -- {}
22
+ if p & 1 > 0 || (n - q )& 1 > 0 {
23
+ Fprint (out , "Alice" )
24
+ } else {
25
+ Fprint (out , "Bob" )
26
+ }
27
+ }
28
+
29
+ //func main() { CF1600E(os.Stdin, os.Stdout) }
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "github.com/EndlessCheng/codeforces-go/main/testutil"
5
+ "testing"
6
+ )
7
+
8
+ // https://codeforces.com/problemset/problem/1600/E
9
+ // https://codeforces.com/problemset/status/1600/problem/E
10
+ func TestCF1600E (t * testing.T ) {
11
+ // just copy from website
12
+ rawText := `
13
+ inputCopy
14
+ 1
15
+ 5
16
+ outputCopy
17
+ Alice
18
+ inputCopy
19
+ 3
20
+ 5 4 5
21
+ outputCopy
22
+ Alice
23
+ inputCopy
24
+ 6
25
+ 5 8 2 1 10 9
26
+ outputCopy
27
+ Bob`
28
+ testutil .AssertEqualCase (t , rawText , 0 , CF1600E )
29
+ }
You can’t perform that action at this time.
0 commit comments