Submission #1521080


Source Code Expand

import java.io.*;
import java.util.*;
public class Main{
	public static void main(String[] args)throws Throwable {
		MyScanner sc=new MyScanner();
		PrintWriter pw=new PrintWriter(System.out);
		
		int n=sc.nextInt();
		int k=sc.nextInt();
		int [] a=new int [n];
		boolean ok=false;
		boolean greater=false;
		int g=0;
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
			if(a[i]==k)
				ok=true;
			if(a[i]>k)
				greater=true;
			g=gcd(a[i], g);
		}
		if(greater && k%g==0)
			ok=true;
		pw.println(ok? "POSSIBLE" : "IMPOSSIBLE");
		pw.flush();
		pw.close();
	}
	
	static int gcd(int a,int b){
		return b==0? a : gcd(b,a%b);
	}
	
	static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {while (st == null || !st.hasMoreElements()) {
			try {st = new StringTokenizer(br.readLine());}
			catch (IOException e) {e.printStackTrace();}}
		return st.nextToken();}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());}
		double nextDouble() {return Double.parseDouble(next());}
		String nextLine(){String str = "";
		try {str = br.readLine();}
		catch (IOException e) {e.printStackTrace();}
		return str;}
	}
}

Submission Info

Submission Time
Task A - Getting Difference
User Kharouba
Language Java8 (OpenJDK 1.8.0)
Score 300
Code Size 1320 Byte
Status AC
Exec Time 187 ms
Memory 35600 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 19
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 AC 68 ms 21332 KB
sample_02.txt AC 70 ms 17748 KB
sample_03.txt AC 68 ms 19284 KB
sample_04.txt AC 69 ms 18132 KB
subtask_1_01.txt AC 69 ms 20820 KB
subtask_1_02.txt AC 69 ms 19028 KB
subtask_1_03.txt AC 187 ms 35600 KB
subtask_1_04.txt AC 170 ms 35380 KB
subtask_1_05.txt AC 161 ms 27968 KB
subtask_1_06.txt AC 121 ms 21332 KB
subtask_1_07.txt AC 155 ms 28256 KB
subtask_1_08.txt AC 172 ms 33804 KB
subtask_1_09.txt AC 148 ms 30032 KB
subtask_1_10.txt AC 171 ms 33676 KB
subtask_1_11.txt AC 157 ms 33644 KB