package main import . "fmt" func main() { var n int Scan(&n) xx:=make([]int,301) yy:=make([]int,301) var mx,my int for i:=0;ixx[mx] { mx=x } if yy[y]>yy[my] { my=y } } var s int for i,c:=range xx { dx:=i-mx if dx<0 { dx=-dx } s+=dx*c dy:=i-my if dy<0 { dy=-dy } s+=dy*yy[i] } Println(s) }