Submission #6397041
Source Code Expand
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long k = sc.nextLong(); List<Long> a = new ArrayList<>(); for (int i = 0; i < n; i++){ a.add(sc.nextLong()); } int i = 0; int j = 0; long diff = 0; while(i < a.size()){ j = i+1; while(j<a.size()){ diff = Math.abs(a.get(i)-a.get(j)); if((diff)==k){ System.out.println("POSSIBLE"); System.exit(0); } if(!a.contains(diff)){ a.add(diff); } j++; } i++; } System.out.println("IMPOSSIBLE"); } }
Submission Info
Submission Time | |
---|---|
Task | A - Getting Difference |
User | moritomo7315 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 886 Byte |
Status | WA |
Exec Time | 2109 ms |
Memory | 62384 KB |
Judge Result
Set Name | Sample | All | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | WA | 93 ms | 21844 KB |
sample_02.txt | AC | 96 ms | 21712 KB |
sample_03.txt | AC | 92 ms | 18644 KB |
sample_04.txt | AC | 95 ms | 19540 KB |
subtask_1_01.txt | WA | 92 ms | 19284 KB |
subtask_1_02.txt | AC | 92 ms | 18640 KB |
subtask_1_03.txt | TLE | 2109 ms | 50232 KB |
subtask_1_04.txt | TLE | 2109 ms | 59108 KB |
subtask_1_05.txt | TLE | 2109 ms | 39816 KB |
subtask_1_06.txt | TLE | 2105 ms | 38416 KB |
subtask_1_07.txt | TLE | 2109 ms | 44380 KB |
subtask_1_08.txt | TLE | 2109 ms | 62384 KB |
subtask_1_09.txt | TLE | 2109 ms | 42928 KB |
subtask_1_10.txt | TLE | 2109 ms | 45464 KB |
subtask_1_11.txt | TLE | 2109 ms | 57892 KB |