結果
問題 | No.674 n連勤 |
ユーザー | te-sh |
提出日時 | 2018-04-16 14:22:11 |
言語 | D (dmd 2.106.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 775 bytes |
コンパイル時間 | 1,846 ms |
コンパイル使用メモリ | 155,296 KB |
実行使用メモリ | 6,056 KB |
最終ジャッジ日時 | 2023-09-03 19:29:46 |
合計ジャッジ時間 | 3,189 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | WA | - |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 2 ms
4,376 KB |
testcase_09 | AC | 1 ms
4,376 KB |
testcase_10 | AC | 1 ms
4,380 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 35 ms
4,380 KB |
testcase_14 | AC | 27 ms
4,380 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
ソースコード
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string; void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}} void main() { long d; int q; readV(d, q); struct P { long a, b; } auto inf = 2*10L^^18, m = 0L, rbt = redBlackTree!"a.a<b.a"([P(-inf, -inf), P(inf, inf)]); foreach (_; 0..q) { long a, b; readV(a, b); ++b; auto p = P(a, b), pr = rbt.lowerBound(p).back, u = pr.b < a ? p : P(pr.a, max(pr.b, b)); P[] rm; foreach (po; rbt.upperBound(P(a-1, b))) { if (po.a > u.b) break; rm ~= po; u = P(u.a, max(u.b, po.b)); } foreach (rmi; rm) rbt.removeKey(rmi); m = max(m, u.b-u.a); rbt.insert(u); writeln(m); } }