結果
| 問題 |
No.561 東京と京都
|
| コンテスト | |
| ユーザー |
kagiya17
|
| 提出日時 | 2018-12-07 21:19:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,092 bytes |
| コンパイル時間 | 895 ms |
| コンパイル使用メモリ | 101,764 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 03:36:50 |
| 合計ジャッジ時間 | 1,752 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <array>
#include <vector>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#include <complex>
#include <bitset>
#define full(c) c.begin(), c.end()
#define vector2d(name,type,h,w,init) vector<vector<type>> name(h,vector<type>(w,init))
const int PRIME = 1000000007;
const int INT_INF = 2147483647;
const long long int LL_INF = 9223372036854775807;
const double PI = acos(-1);
const double EPS = 0.0001;
typedef unsigned long long int ull;
typedef long long int ll;
using namespace std;
int main() {
//cin.tie(0);
//ios::sync_with_stdio(false);
ll n, d, mt = 0, mk = 0;
cin >> n >> d;
mk -= d;
for (int i = 0; i < n; i++) {
ll t, k, nt, nk;
cin >> t >> k;
nt = max(mt + t, mk + k - d);
nk = max(mt + t - d, mk + k);
mt = nt;
mk = nk;
}
cout << max(mt, mk) << endl;
return 0;
}
kagiya17