Submission #3324193
Source Code Expand
import java.util.*; import java.awt.*; import static java.lang.System.*; import static java.lang.Math.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(in); int N=sc.nextInt(); int H=sc.nextInt(); int A=sc.nextInt(); int B=sc.nextInt(); int C=sc.nextInt(); int D=sc.nextInt(); int E=sc.nextInt(); int ans=Integer.MAX_VALUE; Queue<Point> q=new ArrayDeque<>(); Queue<Integer> d=new ArrayDeque<>(); q.add(new Point(H,0)); d.add(0); while(!q.isEmpty()){ Point p=q.poll(); int ManpukuP=p.x; int Shokuhi=p.y; int day=d.poll()+1; q.add(new Point(ManpukuP+B,Shokuhi+A)); d.add(day); q.add(new Point(ManpukuP+D,Shokuhi+C)); d.add(day); if(ManpukuP-E>0){ q.add(new Point(ManpukuP-E,Shokuhi)); d.add(day); } if(day-1==N){ ans=min(ans,p.y); } if(day>N+1)break; } out.println(ans); } }
Submission Info
Submission Time | |
---|---|
Task | C - 節制 |
User | NS601023 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 10 |
Code Size | 1189 Byte |
Status | TLE |
Exec Time | 2115 ms |
Memory | 351388 KB |
Judge Result
Set Name | Subtask1 | Subtask2 | Subtask3 | Subtask4 | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 10 / 10 | 0 / 30 | 0 / 60 | 0 / 1 | ||||||||||||||
Status |
|
|
|
|
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, sample_1.txt, sample_2.txt, sample_3.txt, sample_4.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01_010.txt | AC | 93 ms | 21588 KB |
01_011.txt | AC | 99 ms | 19796 KB |
01_020.txt | AC | 106 ms | 20816 KB |
01_021.txt | AC | 94 ms | 21716 KB |
01_100.txt | AC | 93 ms | 18888 KB |
01_101.txt | AC | 103 ms | 22740 KB |
01_110.txt | AC | 95 ms | 20816 KB |
01_111.txt | AC | 107 ms | 21076 KB |
01_200.txt | AC | 108 ms | 20688 KB |
01_201.txt | AC | 106 ms | 20948 KB |
01_220.txt | AC | 110 ms | 22868 KB |
01_221.txt | AC | 106 ms | 21204 KB |
01_random01.txt | AC | 92 ms | 20692 KB |
01_random02.txt | AC | 114 ms | 24148 KB |
01_random03.txt | AC | 94 ms | 20692 KB |
01_random04.txt | AC | 111 ms | 21332 KB |
01_random05.txt | AC | 92 ms | 20692 KB |
01_random06.txt | AC | 101 ms | 23252 KB |
01_random07.txt | AC | 95 ms | 19792 KB |
01_random08.txt | AC | 108 ms | 22612 KB |
01_random09.txt | AC | 106 ms | 22996 KB |
01_random10.txt | AC | 95 ms | 20692 KB |
02_010.txt | TLE | 2111 ms | 316720 KB |
02_011.txt | TLE | 2115 ms | 335064 KB |
02_020.txt | AC | 750 ms | 103976 KB |
02_021.txt | TLE | 2107 ms | 334916 KB |
02_100.txt | TLE | 2107 ms | 329152 KB |
02_101.txt | TLE | 2111 ms | 323904 KB |
02_110.txt | AC | 94 ms | 21460 KB |
02_111.txt | TLE | 2111 ms | 327752 KB |
02_200.txt | TLE | 2111 ms | 323240 KB |
02_201.txt | TLE | 2110 ms | 265052 KB |
02_220.txt | AC | 110 ms | 22996 KB |
02_221.txt | TLE | 2107 ms | 326228 KB |
02_random01.txt | TLE | 2108 ms | 338268 KB |
02_random02.txt | TLE | 2111 ms | 323392 KB |
02_random03.txt | TLE | 2107 ms | 333320 KB |
02_random04.txt | TLE | 2107 ms | 269636 KB |
02_random05.txt | TLE | 2111 ms | 323244 KB |
02_random06.txt | AC | 97 ms | 22100 KB |
02_random07.txt | TLE | 2112 ms | 351388 KB |
02_random08.txt | AC | 211 ms | 45888 KB |
02_random09.txt | TLE | 2108 ms | 339980 KB |
02_random10.txt | TLE | 2107 ms | 326564 KB |
03_010.txt | TLE | 2107 ms | 338848 KB |
03_011.txt | TLE | 2107 ms | 340316 KB |
03_012.txt | TLE | 2111 ms | 343908 KB |
03_020.txt | TLE | 2107 ms | 338852 KB |
03_021.txt | TLE | 2110 ms | 330796 KB |
03_022.txt | TLE | 2107 ms | 329808 KB |
03_100.txt | TLE | 2107 ms | 337164 KB |
03_101.txt | TLE | 2107 ms | 337236 KB |
03_102.txt | TLE | 2107 ms | 327988 KB |
03_110.txt | TLE | 2108 ms | 338788 KB |
03_111.txt | TLE | 2111 ms | 329684 KB |
03_112.txt | TLE | 2111 ms | 343476 KB |
03_200.txt | TLE | 2107 ms | 328492 KB |
03_201.txt | TLE | 2111 ms | 335972 KB |
03_202.txt | TLE | 2107 ms | 268452 KB |
03_220.txt | TLE | 2107 ms | 338664 KB |
03_221.txt | TLE | 2107 ms | 339616 KB |
03_222.txt | TLE | 2107 ms | 342372 KB |
03_random01.txt | TLE | 2107 ms | 327472 KB |
03_random02.txt | TLE | 2111 ms | 334372 KB |
03_random03.txt | TLE | 2107 ms | 342824 KB |
03_random04.txt | TLE | 2107 ms | 331444 KB |
03_random05.txt | TLE | 2107 ms | 333476 KB |
03_random06.txt | TLE | 2107 ms | 330820 KB |
03_random07.txt | TLE | 2107 ms | 334012 KB |
03_random08.txt | TLE | 2107 ms | 332468 KB |
03_random09.txt | TLE | 2107 ms | 340504 KB |
03_random10.txt | TLE | 2107 ms | 340580 KB |
03_random11.txt | TLE | 2107 ms | 326608 KB |
03_random12.txt | TLE | 2111 ms | 343868 KB |
03_random13.txt | TLE | 2111 ms | 307164 KB |
03_random14.txt | TLE | 2107 ms | 337880 KB |
03_random15.txt | TLE | 2107 ms | 323512 KB |
03_random16.txt | TLE | 2111 ms | 313572 KB |
03_random17.txt | TLE | 2111 ms | 332736 KB |
03_random18.txt | TLE | 2111 ms | 336756 KB |
03_random19.txt | TLE | 2107 ms | 332984 KB |
03_random20.txt | TLE | 2107 ms | 329488 KB |
04_010.txt | TLE | 2107 ms | 328488 KB |
04_011.txt | TLE | 2107 ms | 341552 KB |
04_020.txt | TLE | 2107 ms | 337828 KB |
04_021.txt | TLE | 2107 ms | 261668 KB |
04_100.txt | TLE | 2111 ms | 335652 KB |
04_101.txt | TLE | 2111 ms | 339008 KB |
04_110.txt | TLE | 2111 ms | 341176 KB |
04_111.txt | TLE | 2107 ms | 328344 KB |
04_200.txt | TLE | 2111 ms | 339356 KB |
04_201.txt | TLE | 2111 ms | 337312 KB |
04_220.txt | TLE | 2107 ms | 332904 KB |
04_221.txt | TLE | 2111 ms | 338236 KB |
04_random01.txt | TLE | 2111 ms | 340096 KB |
04_random02.txt | TLE | 2107 ms | 335132 KB |
04_random03.txt | TLE | 2107 ms | 335784 KB |
04_random04.txt | TLE | 2107 ms | 333768 KB |
04_random05.txt | TLE | 2107 ms | 328472 KB |
sample_1.txt | AC | 94 ms | 20944 KB |
sample_2.txt | AC | 101 ms | 21204 KB |
sample_3.txt | AC | 109 ms | 23892 KB |
sample_4.txt | TLE | 2111 ms | 345612 KB |