# Untitled

unknown
plain_text
a year ago
2.2 kB
0
Indexable
Never
```import java.util.Scanner;

public class Solution {

static int n, ans, minT, maxT;
static int[] len, point, arrive, leave;

private static boolean check(int k, int i){
int start = i, end = i + len[k];
for(int j = 0; j < 3; j++){
if(j != k){

}
}

return true;
}

private static int findPoint(){
int sum = 0, max; boolean flag;
for(int i = 0; i < n; i++){
max = 0; flag = false;
for(int j = 0; j < 3; j++){
if(!flag){
flag = true;
max = j;
}
else max = point[max] < point[j] ? j : max;
}
}
if(flag) sum += point[max];
}

return sum;

}

private static void solve(int k){
if(k == 3){
int tmp = findPoint();
ans = tmp > ans ? tmp : ans;
return;
}

for(int i = minT; i <= maxT; i++){
if(check(k, i)){

solve(k + 1);

}
}
}

public static void main(String[] args) {
// TODO Auto-generated method stub

Scanner sc = new Scanner(System.in);
int testcase = sc.nextInt();
for(int tc = 1; tc <= testcase; tc++){
n = sc.nextInt();
len = new int[3]; point = new int[3];
len[0] = sc.nextInt(); len[1] = sc.nextInt(); len[2] = sc.nextInt();
point[0] = sc.nextInt(); point[1] = sc.nextInt(); point[2] = sc.nextInt();

arrive = new int[n]; leave = new int[n];
int tmp; minT = 100; maxT = 0;
for(int i = 0; i < n; i++){
arrive[i] = sc.nextInt();
minT = arrive[i] < minT ? arrive[i] : minT;
tmp = sc.nextInt();
leave[i] = arrive[i] + tmp;
maxT = leave[i]> maxT ? leave[i] : maxT;
}