比赛 ry分享赛 评测结果 WWWWWWWWAW
题目名称 跳跳虎 最终得分 10
用户昵称 LikableP 运行时间 0.018 s
代码语言 C++ 内存使用 1.56 MiB
提交时间 2026-03-19 20:28:48
显示代码纯文本
#include <cstdio>
#include <cmath>

const int MAXN = 5010;

int T;
int n, d;
int depth[MAXN];

int main() {
  #ifdef LOCAL
    freopen("!input.in", "r", stdin);
    freopen("!output.out", "w", stdout);
  #else
    freopen("tiger.in", "r", stdin);
    freopen("tiger.out", "w", stdout);
  #endif

  scanf("%d", &T);
  while (T--) {
    scanf("%d %d", &n, &d);
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &depth[i]);
    }
    if (abs(depth[n] - depth[1]) > 2 * d || (n == 2 && abs(depth[1] - depth[2]) > d)) {
      puts("impossible");
    } else {
      puts("6");
    }
  }
  return 0;
}