結果
| 問題 |
No.139 交差点
|
| コンテスト | |
| ユーザー |
nanophoto12
|
| 提出日時 | 2016-01-12 00:13:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,499 bytes |
| コンパイル時間 | 632 ms |
| コンパイル使用メモリ | 86,864 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-19 18:48:35 |
| 合計ジャッジ時間 | 1,542 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 7 |
ソースコード
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <limits>
using namespace std;
#define REP(x,y) for(int x = 0;x < (y);x++)
#define LLI long long int
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define _L(x) cout<<(x)<<endl
LLI dp[101010][2]; // pos, less
int N, L;
struct Data
{
LLI X;
LLI W;
LLI T;
LLI GetWait(LLI time) const
{
LLI sdiv = time / T;
LLI ediv = (time+W) / T;
LLI mod = time % T;
if((sdiv % 2) == 0 && (ediv % 2 == 0))
{
return 0;
}
else if((sdiv % 2) == 0)
{
return T - mod + T;
}
else
{
return T - mod;
}
}
};
vector<Data> values;
int main()
{
cin >> N >> L;
values.resize(N);
REP(i, N)
{
Data e;
cin >> e.X >> e.W >> e.T;
values[i] = e;
}
LLI currentTime = 0;
LLI currentPosition = 0;
REP(i, N)
{
currentTime += values[i].X - currentPosition;
LLI wait =values[i].GetWait(currentTime);
//cout << wait << endl;
currentTime += wait;
currentTime += values[i].W;
currentPosition = values[i].X + values[i].W;
}
currentTime += L - (values.back().X + values.back().W);
cout << currentTime << endl;
}
nanophoto12