/* yukicoder My Practice * author: Leonardone @ NEETSDKASU */ package main import ( "bufio"; "os"; "strconv"; "strings" "fmt" ) func solve(mr *MyReader) { n, m := I2(mr.Gis()) ansidx := 0 ansval := 0.0 for idx, es := range mr.NGis(m) { val := 0 for a := 0; a < n - 2; a++ { for b := a + 1; b < n - 1; b++ { for c := b + 1; c < n; c++ { if (es[b] > es[a] && es[a] > es[c]) || (es[b] > es[c] && es[c] > es[a]) { val += es[b] } else if es[c] > es[a] && es[a] > es[b] { val += es[c] } else if es[a] > es[c] && es[c] > es[b] { val += es[a] } } } } expval := float64(val) / float64(n * (n - 1) * (n - 2)) if expval > ansval { ansval = expval ansidx = idx } } fmt.Println(ansidx) } ////////////////////////////////////////////////////////////////// // 別に fmt.Scanf() を使ってもいいんだけどね、無駄に定義しまくり func Ti(s string) (v int) { v, _ = strconv.Atoi(s); return } func Tl(s string) (v int64) { v, _ = strconv.ParseInt(s, 10, 64); return } type MyReader struct { scn *bufio.Scanner } func NewMyReader() (mr *MyReader) { mr = new(MyReader); mr.scn = bufio.NewScanner(os.Stdin); return } func (mr *MyReader) Gs() string { mr.scn.Scan(); return mr.scn.Text() } func (mr *MyReader) Gi() int { return Ti(mr.Gs()) } func (mr *MyReader) Gl() int64 { return Tl(mr.Gs()) } func (mr *MyReader) Gss() []string { return strings.Split(mr.Gs(), " ") } func (mr *MyReader) Gis() (vs []int) { for _, v := range mr.Gss() { vs = append(vs, Ti(v)) }; return } func (mr *MyReader) NGs(n int) (ss []string) { for i := 0; i < n; i++ { ss = append(ss, mr.Gs()) }; return } func (mr *MyReader) NGi(n int) (vs []int) { for i := 0; i < n; i++ { vs = append(vs, mr.Gi()) }; return } func (mr *MyReader) NGss(n int) (sss [][]string) { for i := 0; i < n; i++ { sss = append(sss, mr.Gss()) }; return } func (mr *MyReader) NGis(n int) (vss [][]int) { for i := 0; i < n; i++ { vss = append(vss, mr.Gis()) }; return } func Bind(vs []int, v ...*int) { for i := range v { *v[i] = vs[i] } } func I2(a []int) (int, int) { return a[0], a[1] } func I3(a []int) (int, int, int) { return a[0], a[1], a[2] } func I4(a []int) (int, int, int, int) { return a[0], a[1], a[2], a[3] } func I5(a []int) (int, int, int, int, int) { return a[0], a[1], a[2], a[3], a[4] } func Min(v int, vs ...int) (r int) { r = v; for _, x := range vs { if x < r { r = x } }; return } func Max(v int, vs ...int) (r int) { r = v; for _, x := range vs { if x > r { r = x } }; return } func MinMax(v int, vs ...int) (mn, mx int) { mn, mx = v, v; for _, x := range vs { if x < mn { mn = x } else if x > mx { mx = x } }; return } func MinElem(vs []int) (v, idx int) { if len(vs) == 0 { return 0,-1 }; v = vs[0]; for i, x := range vs[1:] { if x < v { v, idx = x, i } }; return } func MaxElem(vs []int) (v, idx int) { if len(vs) == 0 { return 0,-1 }; v = vs[0]; for i, x := range vs[1:] { if x > v { v, idx = x, i } }; return } func main() { solve(NewMyReader()) }