結果
問題 | No.139 交差点 |
ユーザー |
|
提出日時 | 2016-09-05 02:39:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 5,000 ms |
コード長 | 1,010 bytes |
コンパイル時間 | 1,603 ms |
コンパイル使用メモリ | 169,728 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-15 20:18:21 |
合計ジャッジ時間 | 2,736 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS#define _USE_MATH_DEFINES#include "bits/stdc++.h"#define REP(i,a,b) for(i=a;i<b;++i)#define rep(i,n) REP(i,0,n)#define ll long long#define ull unsigned lltypedef long double ld;#define ALL(a) begin(a),end(a)#define ifnot(a) if(not a)#define dump(x) cerr << #x << " = " << (x) << endlusing namespace std;// #define int llbool test = 0;int dx[] = { 0,1,0,-1 };int dy[] = { 1,0,-1,0 };#define INF (1 << 28)ull mod = (int)1e9 + 7;//.....................#define MAX (int)1e6 + 5signed main(void) {ll i, j, k, l;ll N, L;cin >> N >> L;vector<ll> X(N+1), W(N), T(N);rep(i, N) {cin >> X[i] >> W[i] >> T[i];}X[N] = L;ll current_time = X[0];rep(i, N) {ll blue_time = T[i] - current_time % (2*T[i]);dump(blue_time);if (blue_time < W[i]) {current_time += T[i] + blue_time + W[i];}else {current_time += W[i];}current_time += X[i + 1] - (X[i] + W[i]);dump(current_time);}cout << current_time << endl;return 0;}