結果
| 問題 |
No.139 交差点
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-06-06 18:27:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 651 bytes |
| コンパイル時間 | 498 ms |
| コンパイル使用メモリ | 61,456 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 14:27:42 |
| 合計ジャッジ時間 | 1,333 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#include <algorithm>
#include <bitset>
#include <cassert>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef pair<int, int> PI;
const double EPS=1e-9;
int main(void){
int n,l;
cin >> n >> l;
ll cur = 0;
ll pos = 0;
REP(i, 0, n) {
int x, w, t;
cin >> x >> w >> t;
cur += x - pos;
pos = x;
ll stage = cur % (2 * t);
if (stage > t - w) {
cur += 2 * t - stage + w;
} else {
cur += w;
}
pos += w;
}
cout << cur + l - pos << endl;
}