結果
問題 | No.139 交差点 |
ユーザー |
![]() |
提出日時 | 2016-03-15 14:13:47 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 652 bytes |
コンパイル時間 | 556 ms |
コンパイル使用メモリ | 60,024 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-01 06:35:10 |
合計ジャッジ時間 | 1,297 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;#define RREP(i,s,e) for (i = e-1; i >= s; i--)#define rrep(i,n) RREP(i,0,n)#define REP(i,s,e) for (i = s; i < e; i++)#define rep(i,n) REP(i,0,n)#define INF 1e8typedef long long ll;int main() {int i, n, l, t, pos, ans;cin >> n >> l;ans = pos = 0;rep (i,n) {int x, w, t;cin >> x >> w >> t;ans += x - pos;if (ans/t%2 == 1 || ans < ans/t*t || (ans/t+1)*t < ans+w)ans = (ans/t+2-ans/t%2) * t;ans += w;pos = x + w;}ans += l - pos;cout << ans << endl;return 0;}