Contest Duration: - (local time) (120 minutes) Back to Home

Submission #214713

Source Code Expand

Copy
```import java.io.BufferedInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
//public static final int C = 1000000007;
//static int map[][];
//static int N;
//static int M;
//static int tic[][];
//static int dp[][];
static int a[][];
static ArrayList<HashMap<Long, Long>> al;

public static void main(String[] args) {
//StringBuilder sb = new StringBuilder();
BufferedInputStream bs = new BufferedInputStream(System.in);
Scanner sc = new Scanner(bs);

int n = sc.nextInt();

int h = sc.nextInt();

a = new int[3][2];
a[0][0] = sc.nextInt();
a[0][1] = sc.nextInt();
a[1][0] = sc.nextInt();
a[1][1] = sc.nextInt();
a[2][0] = 0;
a[2][1] = -sc.nextInt();
al = new ArrayList<HashMap<Long,Long>>();
for (int i=0; i < n; i++) {
}
/*dp = new int[n+1][-a[2][1]+1];
for (int i=0; i < n+1; i++) {
for (int t=0; t < -a[2][1]+1; t++) {
dp[i][t] = -1;
}
}*/
//HashMap<Integer, ArrayList<Integer>> hm = new HashMap<Integer, ArrayList<Integer>>();

//int map[][] = new int[n][n];

long ans = set(n, h);

System.out.println(ans);

}
static long set(int n, long h) {
if (n == 0) return 0;
if (h >= -a[2][1] +1) {
long rtn =set(n-1, h + a[2][1]);
return rtn;
}
if (al.get(n-1).containsKey(h)) return al.get(n-1).get(h);

long m[] = new long[3];
for (int i=0; i < 3; i++) {
if (h + a[i][1] <= 0) {
m[i] = Long.MAX_VALUE;
continue;
}
m[i] = a[i][0] + set(n-1, h + a[i][1]);
}
long rtn =  Math.min(m[0], Math.min(m[1], m[2]));
al.get(n-1).put(h, rtn);
return rtn;
}

}
```

#### Submission Info

Submission Time 2014-08-16 22:47:01+0900 C - 節制 kiki33 Java (OpenJDK 1.7.0) 100 1790 Byte TLE 2617 ms 591732 KB

#### Judge Result

Score / Max Score 10 / 10 30 / 30 60 / 60 0 / 1
Status
 AC × 25
 AC × 25
 AC × 86
 AC × 83 TLE × 16
Set Name Test Cases
Subtask1 sample_1.txt, sample_2.txt, sample_3.txt, 01_010.txt, 01_011.txt, 01_020.txt, 01_021.txt, 01_100.txt, 01_101.txt, 01_110.txt, 01_111.txt, 01_200.txt, 01_201.txt, 01_220.txt, 01_221.txt, 01_random01.txt, 01_random02.txt, 01_random03.txt, 01_random04.txt, 01_random05.txt, 01_random06.txt, 01_random07.txt, 01_random08.txt, 01_random09.txt, 01_random10.txt
Subtask2 sample_1.txt, sample_2.txt, sample_3.txt, 02_010.txt, 02_011.txt, 02_020.txt, 02_021.txt, 02_100.txt, 02_101.txt, 02_110.txt, 02_111.txt, 02_200.txt, 02_201.txt, 02_220.txt, 02_221.txt, 02_random01.txt, 02_random02.txt, 02_random03.txt, 02_random04.txt, 02_random05.txt, 02_random06.txt, 02_random07.txt, 02_random08.txt, 02_random09.txt, 02_random10.txt
Subtask3 sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt, 01_010.txt, 01_011.txt, 01_020.txt, 01_021.txt, 01_100.txt, 01_101.txt, 01_110.txt, 01_111.txt, 01_200.txt, 01_201.txt, 01_220.txt, 01_221.txt, 01_random01.txt, 01_random02.txt, 01_random03.txt, 01_random04.txt, 01_random05.txt, 01_random06.txt, 01_random07.txt, 01_random08.txt, 01_random09.txt, 01_random10.txt, 02_010.txt, 02_011.txt, 02_020.txt, 02_021.txt, 02_100.txt, 02_101.txt, 02_110.txt, 02_111.txt, 02_200.txt, 02_201.txt, 02_220.txt, 02_221.txt, 02_random01.txt, 02_random02.txt, 02_random03.txt, 02_random04.txt, 02_random05.txt, 02_random06.txt, 02_random07.txt, 02_random08.txt, 02_random09.txt, 02_random10.txt, 03_010.txt, 03_011.txt, 03_012.txt, 03_020.txt, 03_021.txt, 03_022.txt, 03_100.txt, 03_101.txt, 03_102.txt, 03_110.txt, 03_111.txt, 03_112.txt, 03_200.txt, 03_201.txt, 03_202.txt, 03_220.txt, 03_221.txt, 03_222.txt, 03_random01.txt, 03_random02.txt, 03_random03.txt, 03_random04.txt, 03_random05.txt, 03_random06.txt, 03_random07.txt, 03_random08.txt, 03_random09.txt, 03_random10.txt, 03_random11.txt, 03_random12.txt, 03_random13.txt, 03_random14.txt, 03_random15.txt, 03_random16.txt, 03_random17.txt, 03_random18.txt, 03_random19.txt, 03_random20.txt
Subtask4 01_010.txt, 01_011.txt, 01_020.txt, 01_021.txt, 01_100.txt, 01_101.txt, 01_110.txt, 01_111.txt, 01_200.txt, 01_201.txt, 01_220.txt, 01_221.txt, 01_random01.txt, 01_random02.txt, 01_random03.txt, 01_random04.txt, 01_random05.txt, 01_random06.txt, 01_random07.txt, 01_random08.txt, 01_random09.txt, 01_random10.txt, 02_010.txt, 02_011.txt, 02_020.txt, 02_021.txt, 02_100.txt, 02_101.txt, 02_110.txt, 02_111.txt, 02_200.txt, 02_201.txt, 02_220.txt, 02_221.txt, 02_random01.txt, 02_random02.txt, 02_random03.txt, 02_random04.txt, 02_random05.txt, 02_random06.txt, 02_random07.txt, 02_random08.txt, 02_random09.txt, 02_random10.txt, 03_010.txt, 03_011.txt, 03_012.txt, 03_020.txt, 03_021.txt, 03_022.txt, 03_100.txt, 03_101.txt, 03_102.txt, 03_110.txt, 03_111.txt, 03_112.txt, 03_200.txt, 03_201.txt, 03_202.txt, 03_220.txt, 03_221.txt, 03_222.txt, 03_random01.txt, 03_random02.txt, 03_random03.txt, 03_random04.txt, 03_random05.txt, 03_random06.txt, 03_random07.txt, 03_random08.txt, 03_random09.txt, 03_random10.txt, 03_random11.txt, 03_random12.txt, 03_random13.txt, 03_random14.txt, 03_random15.txt, 03_random16.txt, 03_random17.txt, 03_random18.txt, 03_random19.txt, 03_random20.txt, 04_010.txt, 04_011.txt, 04_020.txt, 04_021.txt, 04_100.txt, 04_101.txt, 04_110.txt, 04_111.txt, 04_200.txt, 04_201.txt, 04_220.txt, 04_221.txt, 04_random01.txt, 04_random02.txt, 04_random03.txt, 04_random04.txt, 04_random05.txt
Case Name Status Exec Time Memory
01_010.txt AC 446 ms 23344 KB
01_011.txt AC 446 ms 23212 KB
01_020.txt AC 446 ms 23216 KB
01_021.txt AC 448 ms 23220 KB
01_100.txt AC 452 ms 23216 KB
01_101.txt AC 442 ms 23216 KB
01_110.txt AC 450 ms 23084 KB
01_111.txt AC 446 ms 23208 KB
01_200.txt AC 444 ms 23212 KB
01_201.txt AC 449 ms 23236 KB
01_220.txt AC 446 ms 23212 KB
01_221.txt AC 448 ms 23216 KB
01_random01.txt AC 454 ms 23224 KB
01_random02.txt AC 449 ms 23208 KB
01_random03.txt AC 443 ms 23220 KB
01_random04.txt AC 448 ms 23212 KB
01_random05.txt AC 447 ms 23224 KB
01_random06.txt AC 454 ms 23220 KB
01_random07.txt AC 450 ms 23216 KB
01_random08.txt AC 444 ms 23232 KB
01_random09.txt AC 451 ms 23092 KB
01_random10.txt AC 453 ms 23128 KB
02_010.txt AC 449 ms 23340 KB
02_011.txt AC 455 ms 23336 KB
02_020.txt AC 452 ms 23220 KB
02_021.txt AC 448 ms 23220 KB
02_100.txt AC 450 ms 23216 KB
02_101.txt AC 446 ms 23168 KB
02_110.txt AC 452 ms 23220 KB
02_111.txt AC 450 ms 23216 KB
02_200.txt AC 450 ms 23220 KB
02_201.txt AC 443 ms 23184 KB
02_220.txt AC 453 ms 23216 KB
02_221.txt AC 444 ms 23340 KB
02_random01.txt AC 449 ms 23344 KB
02_random02.txt AC 449 ms 23084 KB
02_random03.txt AC 449 ms 23220 KB
02_random04.txt AC 441 ms 23348 KB
02_random05.txt AC 454 ms 23340 KB
02_random06.txt AC 442 ms 23220 KB
02_random07.txt AC 467 ms 23212 KB
02_random08.txt AC 450 ms 23336 KB
02_random09.txt AC 446 ms 23216 KB
02_random10.txt AC 449 ms 23212 KB
03_010.txt AC 846 ms 51692 KB
03_011.txt AC 457 ms 23340 KB
03_012.txt AC 714 ms 42772 KB
03_020.txt AC 504 ms 26708 KB
03_021.txt AC 885 ms 52044 KB
03_022.txt AC 500 ms 26732 KB
03_100.txt AC 712 ms 42128 KB
03_101.txt AC 477 ms 24860 KB
03_102.txt AC 693 ms 49396 KB
03_110.txt AC 621 ms 37740 KB
03_111.txt AC 703 ms 42880 KB
03_112.txt AC 730 ms 45836 KB
03_200.txt AC 578 ms 32376 KB
03_201.txt AC 694 ms 45284 KB
03_202.txt AC 673 ms 39288 KB
03_220.txt AC 689 ms 40132 KB
03_221.txt AC 649 ms 41620 KB
03_222.txt AC 693 ms 39016 KB
03_random01.txt AC 602 ms 33516 KB
03_random02.txt AC 445 ms 23220 KB
03_random03.txt AC 579 ms 30108 KB
03_random04.txt AC 824 ms 50848 KB
03_random05.txt AC 454 ms 23204 KB
03_random06.txt AC 568 ms 32364 KB
03_random07.txt AC 496 ms 24160 KB
03_random08.txt AC 882 ms 54624 KB
03_random09.txt AC 740 ms 46136 KB
03_random10.txt AC 450 ms 23344 KB
03_random11.txt AC 618 ms 38468 KB
03_random12.txt AC 1181 ms 79624 KB
03_random13.txt AC 651 ms 42264 KB
03_random14.txt AC 654 ms 42068 KB
03_random15.txt AC 443 ms 23212 KB
03_random16.txt AC 874 ms 55432 KB
03_random17.txt AC 898 ms 55436 KB
03_random18.txt AC 452 ms 23344 KB
03_random19.txt AC 557 ms 29840 KB
03_random20.txt AC 449 ms 23220 KB
04_010.txt TLE 2366 ms 502384 KB
04_011.txt TLE 2313 ms 494992 KB
04_020.txt TLE 2298 ms 479916 KB
04_021.txt TLE 2438 ms 478780 KB
04_100.txt TLE 2420 ms 510768 KB
04_101.txt TLE 2459 ms 431156 KB
04_110.txt TLE 2504 ms 353536 KB
04_111.txt TLE 2534 ms 369932 KB
04_200.txt TLE 2216 ms 171928 KB
04_201.txt AC 683 ms 35844 KB
04_220.txt TLE 2398 ms 249472 KB
04_221.txt TLE 2495 ms 444964 KB
04_random01.txt TLE 2102 ms 139952 KB
04_random02.txt TLE 2333 ms 195160 KB
04_random03.txt TLE 2257 ms 303912 KB
04_random04.txt TLE 2617 ms 591732 KB
04_random05.txt TLE 2081 ms 237060 KB
sample_1.txt AC 452 ms 23220 KB
sample_2.txt AC 459 ms 23216 KB
sample_3.txt AC 452 ms 23216 KB
sample_4.txt AC 737 ms 46172 KB