Submission #3736933
Source Code Expand
/* ---------- STL Libraries ---------- */ // IO library #include <cstdio> #include <fstream> #include <iomanip> #include <ios> #include <iostream> // algorithm library #include <algorithm> #include <cmath> #include <numeric> #include <random> // container library #include <array> #include <bitset> #include <deque> #include <map> #include <unordered_map> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> /* ---------- Namespace ---------- */ using namespace std; /* ---------- Type ---------- */ using ll = long long; #define int ll #define P pair<ll, ll> /* ---------- Constants */ const ll MOD = 1e9 + 7; const int INF = 1LL << 55; // const double PI = acos(-1); // const double EPS = 1e-10; // mt19937 mert(LL(time(0))); /* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */ // O(log max(a, b)) int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } signed main() { int N, K; cin >> N >> K; int A[N]; int amax = -1; for (int i = 0; i < N; i++) { cin >> A[i]; amax = max(amax, A[i]); } if (N == 0) { if (N == K) { cout << "POSSIBLE" << endl; return 0; } else { cout << "IMPOSSIBLE" << endl; return 0; } } int ret = gcd(A[0], A[1]); for (int i = 2; i < N; i++) { ret = gcd(ret, A[i]); } if (K % ret == 0 && K <= amax) { cout << "POSSIBLE" << endl; } else { cout << "IMPOSSIBLE" << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Getting Difference |
User | sykwer |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1627 Byte |
Status | AC |
Exec Time | 42 ms |
Memory | 1024 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 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 | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |
sample_04.txt | AC | 1 ms | 256 KB |
subtask_1_01.txt | AC | 1 ms | 256 KB |
subtask_1_02.txt | AC | 1 ms | 256 KB |
subtask_1_03.txt | AC | 42 ms | 1024 KB |
subtask_1_04.txt | AC | 41 ms | 1024 KB |
subtask_1_05.txt | AC | 22 ms | 640 KB |
subtask_1_06.txt | AC | 7 ms | 384 KB |
subtask_1_07.txt | AC | 26 ms | 768 KB |
subtask_1_08.txt | AC | 41 ms | 896 KB |
subtask_1_09.txt | AC | 18 ms | 512 KB |
subtask_1_10.txt | AC | 30 ms | 768 KB |
subtask_1_11.txt | AC | 34 ms | 896 KB |