結果
| 問題 |
No.274 The Wall
|
| コンテスト | |
| ユーザー |
t8m8⛄️
|
| 提出日時 | 2015-08-28 23:05:55 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,327 bytes |
| コンパイル時間 | 3,199 ms |
| コンパイル使用メモリ | 79,608 KB |
| 実行使用メモリ | 57,248 KB |
| 最終ジャッジ日時 | 2024-07-18 15:23:28 |
| 合計ジャッジ時間 | 7,574 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 WA * 8 |
ソースコード
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();
boolean[] f = new boolean[m];
for (int i=0; i<n; i++) {
int l = in.nextInt();
int r = in.nextInt();
if (l > m-r-1) {
int t = l;
l = m - r - 1; r = m - t - 1;
}
// trace(f);
boolean flag = true;
for (int j=l; j<=r; j++) {
if (f[j]) {
flag = false;
break;
}
}
if (flag) {
for (int j=l; j<=r; j++) {
f[j] = true;
}
} else {
int t = l;
l = m - r - 1; r = m - t - 1;
boolean flag2 = true;
for (int j=l; j<=r; j++) {
if (f[j]) {
flag2 = false;
break;
}
}
if (flag2) {
for (int j=l; j<=r; j++) {
f[j] = true;
}
} else {
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));}
}
t8m8⛄️