結果
問題 | No.1675 Strange Minimum Query |
ユーザー | bluemegane |
提出日時 | 2021-09-11 11:08:59 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,377 bytes |
コンパイル時間 | 2,050 ms |
コンパイル使用メモリ | 65,892 KB |
実行使用メモリ | 47,700 KB |
最終ジャッジ日時 | 2023-09-04 21:14:38 |
合計ジャッジ時間 | 14,155 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 66 ms
21,516 KB |
testcase_01 | AC | 65 ms
23,752 KB |
testcase_02 | AC | 66 ms
21,644 KB |
testcase_03 | AC | 338 ms
35,212 KB |
testcase_04 | AC | 288 ms
33,692 KB |
testcase_05 | AC | 81 ms
24,068 KB |
testcase_06 | AC | 385 ms
39,016 KB |
testcase_07 | AC | 391 ms
37,160 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 432 ms
47,700 KB |
testcase_14 | AC | 401 ms
44,560 KB |
testcase_15 | WA | - |
testcase_16 | AC | 64 ms
21,672 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
ソースコード
using static System.Math; using System.Linq; using System; public class P { public int L { get; set; } public int r { get; set; } public int b { get; set; } } public class Hello { public static int BIG = 1000000000; static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); var q = int.Parse(line[1]); var ps = new P[q]; for (int i = 0; i < q; i++) { line = Console.ReadLine().Trim().Split(' '); var L = int.Parse(line[0]) - 1; var r = int.Parse(line[1]) - 1; var b = int.Parse(line[2]); ps[i] = new P { L = L, r = r, b = b }; } getAns(n, q, ps); } static void getAns(int n, int q, P[] ps) { var ans = Enumerable.Repeat(BIG, n).ToArray(); var d = n; var pre = BIG; foreach (var x in ps.OrderByDescending(x => x.b).ThenByDescending(x => x.L)) { var ok = false; var imin = Min(d - 1, x.r); for (int i = imin; i >= x.L; i--) { if (ans[i] > x.b) { ans[i] = x.b; ok = true;} } if (!ok && pre != x.b) { Console.WriteLine(-1); return; } d = x.L; pre = x.b; } Console.WriteLine(string.Join(" ", ans)); } }