Submission #1606764
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)); } if(cur.pos >0 ){ 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 | vjudge5 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 712 Byte |
Status | WA |
Exec Time | 2111 ms |
Memory | 336336 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 | 92 ms | 19028 KB |
0_001.txt | WA | 90 ms | 21844 KB |
0_002.txt | AC | 91 ms | 20564 KB |
1_003.txt | TLE | 2107 ms | 329648 KB |
1_004.txt | TLE | 2110 ms | 319820 KB |
1_005.txt | AC | 91 ms | 19024 KB |
1_006.txt | TLE | 2111 ms | 330600 KB |
1_007.txt | TLE | 2107 ms | 334032 KB |
1_008.txt | TLE | 2110 ms | 329544 KB |
1_009.txt | TLE | 2111 ms | 326308 KB |
1_010.txt | TLE | 2111 ms | 324544 KB |
1_011.txt | TLE | 2111 ms | 330028 KB |
1_012.txt | TLE | 2111 ms | 326336 KB |
1_013.txt | TLE | 2111 ms | 336336 KB |
1_014.txt | TLE | 2110 ms | 329300 KB |
1_015.txt | TLE | 2111 ms | 334164 KB |
1_016.txt | TLE | 2110 ms | 325192 KB |
1_017.txt | TLE | 2111 ms | 323264 KB |