結果

問題 No.2015 Stair Counter
ユーザー tentententen
提出日時 2022-07-25 14:44:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 225 ms / 2,000 ms
コード長 1,470 bytes
コンパイル時間 4,788 ms
コンパイル使用メモリ 73,944 KB
実行使用メモリ 57,720 KB
最終ジャッジ日時 2023-09-21 20:12:32
合計ジャッジ時間 8,483 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
49,260 KB
testcase_01 AC 162 ms
55,444 KB
testcase_02 AC 167 ms
55,368 KB
testcase_03 AC 169 ms
55,096 KB
testcase_04 AC 168 ms
55,848 KB
testcase_05 AC 159 ms
54,780 KB
testcase_06 AC 180 ms
54,664 KB
testcase_07 AC 175 ms
55,104 KB
testcase_08 AC 181 ms
54,896 KB
testcase_09 AC 159 ms
55,800 KB
testcase_10 AC 156 ms
55,732 KB
testcase_11 AC 166 ms
55,448 KB
testcase_12 AC 153 ms
56,988 KB
testcase_13 AC 154 ms
54,192 KB
testcase_14 AC 169 ms
54,616 KB
testcase_15 AC 177 ms
55,056 KB
testcase_16 AC 220 ms
57,176 KB
testcase_17 AC 157 ms
55,312 KB
testcase_18 AC 216 ms
57,132 KB
testcase_19 AC 225 ms
57,720 KB
testcase_20 AC 185 ms
55,792 KB
testcase_21 AC 167 ms
55,508 KB
testcase_22 AC 173 ms
55,216 KB
testcase_23 AC 169 ms
55,140 KB
testcase_24 AC 168 ms
55,292 KB
testcase_25 AC 159 ms
55,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int t = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        while (t-- > 0) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int prev = m;
            boolean enable = true;
            for (int i = 0; i < n; i++) {
                int x = sc.nextInt();
                if (x < m - prev) {
                    enable = false;
                }
                prev = x;
            }
            if (enable) {
                sb.append("Yes\n");
            } else {
                sb.append("No\n");
            }
        }
        System.out.print(sb);
    }
    
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0