結果
| 問題 | No.139 交差点 |
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-02-10 02:12:45 |
| 言語 | C++11(old_compat) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 498 bytes |
| 記録 | |
| コンパイル時間 | 954 ms |
| コンパイル使用メモリ | 170,124 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-08 16:01:25 |
| 合計ジャッジ時間 | 2,063 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n, l;
while (cin>>n>>l) {
vector<long long> x(n), w(n), t(n);
for(int i=0;i<n;++i) cin>>x[i]>>w[i]>>t[i];
auto wt=0LL;
for(int i=0;i<n;++i) {
auto ct=wt+x[i];
auto r=ct/t[i];
if (r%2==1)
wt+=(r+1)*t[i]-ct;
else if (ct+w[i]>(r+1)*t[i])
wt+=(r+2)*t[i]-ct;
}
cout<<l+wt<<endl;
}
}
hogeover30