Submission #1606727
Source Code Expand
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Scanner; import java.util.Hashtable; //https://vjudge.net/contest/159423#problem/B public class Main { public static void main(String [] argv) throws Exception{ // lucky: only contain digits 4, 7. Scanner in = new Scanner(System.in); int a = in.nextInt(); //0 to infinity //between time i-1 and time i, can stay, or jump i spots left or right boolean solved = false; int timeLimit = -1; while(solved == false) { timeLimit++; solved = jump(a, timeLimit, 0); } System.out.println(timeLimit); } static boolean jump(int position, int timeLimit, int time) { if(position == 0) { return true; } else if (time >= timeLimit) { return false; } else { return jump(position - (time + 1), timeLimit, time + 1) || jump(position, timeLimit, time + 1) || jump(position + time + 1, timeLimit, time + 1); } } }
Submission Info
Submission Time | |
---|---|
Task | C - Go Home |
User | vjudge5 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 973 Byte |
Status | TLE |
Exec Time | 2109 ms |
Memory | 22100 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 200 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 89 ms | 21076 KB |
0_001.txt | AC | 90 ms | 21588 KB |
0_002.txt | AC | 91 ms | 19668 KB |
1_003.txt | TLE | 2108 ms | 20180 KB |
1_004.txt | TLE | 2108 ms | 22100 KB |
1_005.txt | AC | 91 ms | 16844 KB |
1_006.txt | TLE | 2108 ms | 20692 KB |
1_007.txt | TLE | 2109 ms | 21716 KB |
1_008.txt | TLE | 2108 ms | 20692 KB |
1_009.txt | TLE | 2109 ms | 17108 KB |
1_010.txt | TLE | 2108 ms | 18772 KB |
1_011.txt | TLE | 2108 ms | 21844 KB |
1_012.txt | TLE | 2108 ms | 21844 KB |
1_013.txt | TLE | 2108 ms | 20692 KB |
1_014.txt | TLE | 2108 ms | 22100 KB |
1_015.txt | TLE | 2109 ms | 19668 KB |
1_016.txt | TLE | 2108 ms | 22100 KB |
1_017.txt | TLE | 2109 ms | 19540 KB |