結果
問題 | No.1205 Eye Drops |
ユーザー |
![]() |
提出日時 | 2020-09-25 17:49:30 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 140 ms / 2,000 ms |
コード長 | 2,088 bytes |
コンパイル時間 | 2,411 ms |
コンパイル使用メモリ | 77,584 KB |
実行使用メモリ | 51,872 KB |
最終ジャッジ日時 | 2024-06-28 05:54:24 |
合計ジャッジ時間 | 6,029 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 37 |
ソースコード
import java.io.*; import java.util.*; public class Main { static MyReader in = new MyReader(); public static void main(String[] args) { int N = in.i(); int M = in.i(); int t0 = 0; int p0 = 0; String ans = "Yes"; for (int i = 0; i < M; i++) { int t1 = in.i(); int p1 = in.i(); if (t1 - t0 < Math.abs(p1 - p0)) { ans = "No"; break; } t0 = t1; p0 = p1; } System.out.println(ans); } } class MyReader extends BufferedReader { char[] cbuf = new char[1024]; int head = 0; int tail = 0; MyReader() { super(new InputStreamReader(System.in)); } char next() { if (head == tail) { try { tail = super.read(cbuf, 0, cbuf.length); } catch (IOException e) { e.printStackTrace(); } head = 0; } return cbuf[head++]; } int i() { int k = next() - '0'; boolean minus = k == -3; int n = minus ? 0 : k; while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k; return minus ? -n : n; } int[] ii(final int N) { int[] a = new int[N]; for (int j = 0; j < a.length; j++) a[j] = i(); return a; } long l() { int k = next() - '0'; boolean minus = k == -3; long n = minus ? 0 : k; while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k; return minus ? -n : n; } char[] s(final int N) { char[] s = new char[N]; for (int i = 0; i < N; i++) { s[i] = next(); } next(); return s; } public int read(char[] cbuf) { int i; char c; for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c; return i; } public String readLine() { try { return super.readLine(); } catch (IOException e) { return null; } } }