Simple Game
시간 제한1초메모리 제한2048 MB
2행 n열 격자에서 (1,1)의 앨리스와 (2,n)의 밥이 서로 방문하지 않은 칸으로 말을 옮길 때, 둘 다 최선을 다할 경우 앨리스가 얻는 점수를 구한다.
문제
Alice and Bob like playing games. Today they play on a special grid with rows and columns. Alice and Bob each have a chess piece, starting at and , respectively. They will take turns moving their chess piece, with Alice going first.
In each turn, they can choose to stay still or move the chess piece to any point adjacent horizontally or vertically which has not been visited by the other's piece. The game will end after turns.
Every point in this grid has a non-negative weight. For each player, the score that he/she gets is the sum of the weights of all the points his/her chess piece has visited. The weight is counted only once, even if the piece visited a point multiple times.
Both Alice and Bob want to maximize the score that they get. As a spectator, you want to know the score that Alice gets if both of them play optimally.
입력
The first line contains an integer , the number of test cases (). The test cases follow.
The first line of each test case contains a single integer representing the size of the grid ().
The second line of each test case contains integers . The -th of them represents the weight of point .
The third line of each test case contains integers . The -th of them represents the weight of point .
It is guaranteed that , and the sum of across all test cases will not exceed .
출력
For each test case, print a line with a single integer: the score that Alice gets if both players play optimally.