Submission #1606864
Source Code Expand
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int x = in.nextInt(); Queue<PosT> queue = new LinkedList<>(); queue.add(new PosT(0,0)); while(queue.size() > 0){ PosT cur = queue.remove(); if(cur.pos == x){ System.out.println(cur.time); return; } queue.add(new PosT(cur.pos+cur.time+1,cur.time+1)); if(cur.pos-cur.time-1 >= 0){ queue.add(new PosT(cur.pos-cur.time-1,cur.time+1)); } queue.add(new PosT(cur.pos,cur.time+1)); } } } class PosT{ public int pos; public int time; public PosT(int _pos, int _time){ pos = _pos; time = _time; } }
Submission Info
Submission Time | |
---|---|
Task | C - Go Home |
User | vjudge4 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 687 Byte |
Status | TLE |
Exec Time | 2112 ms |
Memory | 336932 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 | 93 ms | 19924 KB |
0_001.txt | AC | 94 ms | 21588 KB |
0_002.txt | AC | 93 ms | 18644 KB |
1_003.txt | TLE | 2112 ms | 332844 KB |
1_004.txt | TLE | 2112 ms | 330060 KB |
1_005.txt | AC | 92 ms | 19796 KB |
1_006.txt | TLE | 2112 ms | 333648 KB |
1_007.txt | TLE | 2112 ms | 321728 KB |
1_008.txt | TLE | 2112 ms | 327816 KB |
1_009.txt | TLE | 2112 ms | 330568 KB |
1_010.txt | TLE | 2112 ms | 331532 KB |
1_011.txt | TLE | 2112 ms | 319816 KB |
1_012.txt | TLE | 2112 ms | 325708 KB |
1_013.txt | TLE | 2112 ms | 333580 KB |
1_014.txt | TLE | 2112 ms | 328768 KB |
1_015.txt | TLE | 2112 ms | 329872 KB |
1_016.txt | TLE | 2112 ms | 336932 KB |
1_017.txt | TLE | 2112 ms | 324668 KB |