Submission #1446752
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.Text; class Program { public static bool f = false, t = true; static void Main(string[] args) { long[] n = Console.ReadLine().Split().Select(long.Parse).ToArray(); long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray(); bool ooki = false; for (long i = 0; i < a.Length; i++) { if (a[i] == n[1]) { Console.WriteLine("POSSIBLE"); return; } if (a[i] > n[1] && !ooki) { ooki = true; } } if (!ooki) { Console.WriteLine("IMPOSSIBLE"); return; } bool dekita = f; for (long i = 0; i < a.Length; i++) { for (long k = 0; k < a.Length && i != k; k++) { if (gcm(a[i],a[k])==1) { Console.WriteLine("POSSIBLE"); dekita = t; break; } } if (dekita) { break; } if (i == a.Length - 1) { Console.WriteLine("IMPOSSIBLE"); } } Console.ReadLine(); } public static long gcm(long a, long b) { while (true) { if (a == 0) { return b; } if (b == 0) { return a; } if (a > b) { a -= b; } else { b -= a; } } } public static long lcm(long a, long b) { return a * b / gcm(a, b); } public static bool IsPrime(long n) { if (n < 2) return false; if (n == 2) return true; for (long i = 2; i < n; i++) { if (n % i == 0) return false; } return true; } } public static class Read { public static void outl(string n = "") { Console.WriteLine(n); return; } public static long Long() { return long.Parse(Console.ReadLine()); } public static long[] longs() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); } public static int Int() { return int.Parse(Console.ReadLine()); } public static int[] ints() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); } public static string Str() { return Console.ReadLine(); } public static string[] Strs() { return Console.ReadLine().Split(); } }
Submission Info
Submission Time | |
---|---|
Task | A - Getting Difference |
User | rayhotate |
Language | C# (Mono 4.6.2.0) |
Score | 0 |
Code Size | 2273 Byte |
Status | TLE |
Exec Time | 2108 ms |
Memory | 21984 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 | AC | 23 ms | 13396 KB |
sample_02.txt | AC | 22 ms | 11220 KB |
sample_03.txt | AC | 22 ms | 11220 KB |
sample_04.txt | AC | 22 ms | 11348 KB |
subtask_1_01.txt | AC | 22 ms | 11220 KB |
subtask_1_02.txt | AC | 22 ms | 11348 KB |
subtask_1_03.txt | AC | 69 ms | 20832 KB |
subtask_1_04.txt | AC | 67 ms | 20832 KB |
subtask_1_05.txt | AC | 47 ms | 17248 KB |
subtask_1_06.txt | TLE | 2108 ms | 14304 KB |
subtask_1_07.txt | TLE | 2108 ms | 17248 KB |
subtask_1_08.txt | AC | 75 ms | 21984 KB |
subtask_1_09.txt | TLE | 2108 ms | 14048 KB |
subtask_1_10.txt | TLE | 2108 ms | 18400 KB |
subtask_1_11.txt | AC | 61 ms | 19424 KB |