Skip to content

Commit 3dbdc73

Browse files
committed
codeforces Round 91 (Div. 2 - A) - Three Indices
1 parent c0441ef commit 3dbdc73

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

problem35/main.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
//Round 91 (Div. 2 - A) - Three Indices
3+
4+
package main
5+
6+
import (
7+
"bufio"
8+
"fmt"
9+
"os"
10+
"strconv"
11+
)
12+
13+
func main() {
14+
scanner := bufio.NewScanner(os.Stdin)
15+
scanner.Split(bufio.ScanWords)
16+
scanner.Scan()
17+
t,_ := strconv.Atoi(scanner.Text())
18+
for t > 0 {
19+
scanner.Scan()
20+
n, _ := strconv.Atoi(scanner.Text())
21+
22+
a := make([]int, n+1)
23+
for i := 1; i <= n; i++ {
24+
scanner.Scan()
25+
a[i], _ = strconv.Atoi(scanner.Text())
26+
}
27+
fmt.Println(a)
28+
29+
result := -1
30+
for i := 2; i <= n-1; i++ {
31+
if a[i] > a[i-1] && a[i] > a[i+1] {
32+
result = i
33+
break
34+
}
35+
}
36+
37+
if result != -1 {
38+
fmt.Println("YES")
39+
fmt.Println(result-1, result, result+1)
40+
} else {
41+
fmt.Println("NO")
42+
}
43+
t--
44+
}
45+
}

0 commit comments

Comments
 (0)