結果
| 問題 |
No.561 東京と京都
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-18 14:28:14 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 326 bytes |
| コンパイル時間 | 2,000 ms |
| コンパイル使用メモリ | 192,288 KB |
| 最終ジャッジ日時 | 2025-01-07 14:11:01 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n,d;
cin>>n>>d;
int t,k;
cin>>t>>k;
k-=d;
for (int i=1;i<n;i++) {
int a,b;
cin>>a>>b;
int pt=t;
t=a+max(t,k-d);
k=b+max(pt-d,k);
}
cout<<max(t,k)<<endl;
return 0;
}