結果

問題 No.1205 Eye Drops
ユーザー Ryo Miyagi
提出日時 2020-09-21 18:01:44
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 719 bytes
コンパイル時間 2,476 ms
コンパイル使用メモリ 76,040 KB
実行使用メモリ 74,168 KB
最終ジャッジ日時 2024-06-24 11:51:10
合計ジャッジ時間 14,373 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int range = sc.nextInt();
		int infoNum = sc.nextInt();
		Map<Integer, Integer> info = new TreeMap<>();
		for (int i = 0; i < infoNum;) {
			info.put(sc.nextInt(), sc.nextInt());
			i++;
		}
		int key1 = 0;
		int value1 = 0;
		int key2 = 0;
		int value2 = 0;
		String judgement = "Yes";
		for(Integer key : info.keySet()) {
			key2 = key;
			value2 = info.get(key);
			if(Math.abs(key2 - key1) < Math.abs(value2 - value1)) {
				judgement = "No";
				break;
			}
			key1 = key2;
			value1 = value2;
		}
		System.out.println(judgement);
	}
}
0