結果
| 問題 | No.561 東京と京都 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-09-20 21:01:29 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 754 bytes |
| 記録 | |
| コンパイル時間 | 3,467 ms |
| コンパイル使用メモリ | 85,940 KB |
| 実行使用メモリ | 42,348 KB |
| 最終ジャッジ日時 | 2026-05-08 15:14:05 |
| 合計ジャッジ時間 | 5,986 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 WA * 3 |
ソースコード
package yukicoder;
import java.util.Scanner;
import static java.lang.Math.max;
public class No561 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(), d = sc.nextInt();
int t, k, beforeT, beforeK;
int resultT = 0, resultK = 0;
boolean tokyo = true;
beforeT = sc.nextInt();
beforeK = sc.nextInt() - d;
for(int i = 0; i < n - 1; i++) {
t = sc.nextInt();
k = sc.nextInt();
resultT = t + max(beforeT, beforeK - d);
resultK = k + max(beforeK, beforeT - d);
beforeT = resultT;
beforeK = resultK;
}
System.out.println(max(resultT, resultK));
}
}