結果

問題 No.139 交差点
ユーザー te-shte-sh
提出日時 2017-01-31 17:23:16
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 596 bytes
コンパイル時間 1,415 ms
コンパイル使用メモリ 149,180 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-03 01:12:12
合計ジャッジ時間 4,162 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 WA -
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd1 = readln.split, n = rd1[0].to!size_t, l = rd1[1].to!int;
  auto xi = new int[](n), wi = new int[](n), ti = new int[](n);
  foreach (i; n.iota) {
    auto rd2 = readln.split.to!(int[]);
    xi[i] = rd2[0];
    wi[i] = rd2[1];
    ti[i] = rd2[2];
  }

  auto ct = 0, cx = 0;
  foreach (x, w, t; lockstep(xi, wi, ti)) {
    ct += x - cx;
    cx = x;
    if ((ct + w) / t % 2 == 1 && (ct + w) % t != 0)
      ct = (ct / (2 * t) + 1) * (2 * t);
    ct += w;
    cx += w;
  }
  ct += l - cx;

  writeln(ct);
}
0