結果

問題 No.274 The Wall
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-08-29 00:51:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 876 bytes
コンパイル時間 5,052 ms
コンパイル使用メモリ 75,064 KB
実行使用メモリ 59,596 KB
最終ジャッジ日時 2023-09-04 02:04:05
合計ジャッジ時間 8,852 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,648 KB
testcase_01 AC 121 ms
55,708 KB
testcase_02 AC 121 ms
55,924 KB
testcase_03 AC 188 ms
58,592 KB
testcase_04 AC 119 ms
56,256 KB
testcase_05 AC 119 ms
56,032 KB
testcase_06 AC 119 ms
56,048 KB
testcase_07 AC 118 ms
55,540 KB
testcase_08 AC 119 ms
56,376 KB
testcase_09 AC 122 ms
56,124 KB
testcase_10 AC 120 ms
56,460 KB
testcase_11 AC 222 ms
59,108 KB
testcase_12 AC 208 ms
59,124 KB
testcase_13 AC 144 ms
56,160 KB
testcase_14 AC 188 ms
57,908 KB
testcase_15 AC 190 ms
56,384 KB
testcase_16 AC 212 ms
58,996 KB
testcase_17 AC 203 ms
58,688 KB
testcase_18 AC 201 ms
56,852 KB
testcase_19 AC 199 ms
58,968 KB
testcase_20 AC 201 ms
59,044 KB
testcase_21 AC 208 ms
59,116 KB
testcase_22 AC 208 ms
59,184 KB
testcase_23 AC 201 ms
58,796 KB
testcase_24 AC 200 ms
59,152 KB
testcase_25 AC 210 ms
59,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class No0274 {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int n = in.nextInt();
		int m = in.nextInt();
		int[] cnt = new int[m];
		for (int i=0; i<n; i++) {
			int l = in.nextInt(), r = in.nextInt();
			for (int j=l; j<=r; j++) {
				cnt[j]++; cnt[m-1-j]++;
			}
		}

		for (int i=0; i<m; i++) {
			if (cnt[i] > 2) {
				out.println("NO");
				return;
			}
		}
		out.println("YES");
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}
0