Submission #6396974


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();
        long[] a = new long[n];

        for (int i = 0; i < n; i++){
            a[i] = sc.nextLong();
        }

        int j = 0;

        for(int i = 0; i<n; i++){
            j = i+1;
            while(j<n){
                if(Math.abs(a[i]-a[j])==k){
                    System.out.println("POSSIBLE");
                    System.exit(0);
                }
                j++;
            }
        }
        System.out.println("IMPOSSIBLE");
    }
}

Submission Info

Submission Time
Task A - Getting Difference
User moritomo7315
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 681 Byte
Status CE

Compile Error

./Main.java:9: error: incompatible types: possible lossy conversion from long to int
        long[] a = new long[n];
                            ^
1 error