#include <stdio.h>
#include <algorithm>
using namespace std;
int N, M, K;
int arr[101];
int main()
{
int tc = 0;
scanf("%d", &tc);
for (int t = 1; t <= tc; t++)
{
bool flag = true;
int cnt = 0, idx = 0;
scanf("%d %d %d", &N, &M, &K);
for (int i = 0; i < N; i++)
{
scanf("%d", &arr[i]);
}
sort(arr, arr+N);
if (arr[0] >= M)
{
for (int i = 1; i <= arr[N - 1]; i++)
{
if (i % M == 0)
cnt += K;
if (i == arr[idx])
{
if (cnt > 0)
{
cnt--;
idx++;
}
else
{
flag = false;
break;
}
}
}
}
else
flag = false;
if (flag)
printf("#%d Possible\n", t);
else
printf("#%d Impossible\n", t);
}
return 0;
}
'공부 > SWEA' 카테고리의 다른 글
SWEA 5986. 새샘이와 세 소수 (C++) (0) | 2024.05.06 |
---|---|
SWEA 4522. 세상의 모든 팰린드롬 (C++) (0) | 2024.05.06 |
SWEA 9940. 순열1 (C++) (0) | 2024.05.05 |
SWEA 8338. 계산기 (C++) (0) | 2024.05.05 |
SWEA 9658. 유효숫자 표기 (C++) (0) | 2024.05.05 |