Submission #1521077


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 && g==1)
			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 0
Code Size 1318 Byte
Status WA
Exec Time 181 ms
Memory 36184 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 4
AC × 17
WA × 2
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 74 ms 18772 KB
sample_02.txt AC 71 ms 20692 KB
sample_03.txt AC 69 ms 20180 KB
sample_04.txt AC 72 ms 21076 KB
subtask_1_01.txt AC 75 ms 19028 KB
subtask_1_02.txt AC 70 ms 21204 KB
subtask_1_03.txt AC 181 ms 35852 KB
subtask_1_04.txt AC 177 ms 36184 KB
subtask_1_05.txt AC 152 ms 27600 KB
subtask_1_06.txt WA 113 ms 23252 KB
subtask_1_07.txt AC 164 ms 32100 KB
subtask_1_08.txt AC 170 ms 30988 KB
subtask_1_09.txt WA 152 ms 30268 KB
subtask_1_10.txt AC 171 ms 33876 KB
subtask_1_11.txt AC 180 ms 33804 KB