結果
問題 | No.568 じゃんじゃん 落とす 委員会 |
ユーザー | 6soukiti29 |
提出日時 | 2017-09-14 21:01:23 |
言語 | Nim (2.0.2) |
結果 |
AC
|
実行時間 | 156 ms / 1,000 ms |
コード長 | 1,111 bytes |
コンパイル時間 | 3,267 ms |
コンパイル使用メモリ | 71,916 KB |
実行使用メモリ | 24,412 KB |
最終ジャッジ日時 | 2023-09-12 15:10:57 |
合計ジャッジ時間 | 6,800 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 153 ms
24,412 KB |
testcase_01 | AC | 152 ms
24,384 KB |
testcase_02 | AC | 19 ms
4,380 KB |
testcase_03 | AC | 19 ms
4,376 KB |
testcase_04 | AC | 19 ms
4,380 KB |
testcase_05 | AC | 15 ms
4,376 KB |
testcase_06 | AC | 19 ms
4,376 KB |
testcase_07 | AC | 19 ms
4,376 KB |
testcase_08 | AC | 7 ms
4,380 KB |
testcase_09 | AC | 15 ms
4,376 KB |
testcase_10 | AC | 14 ms
4,380 KB |
testcase_11 | AC | 19 ms
4,380 KB |
testcase_12 | AC | 147 ms
21,664 KB |
testcase_13 | AC | 156 ms
24,364 KB |
testcase_14 | AC | 150 ms
21,592 KB |
testcase_15 | AC | 151 ms
22,084 KB |
testcase_16 | AC | 145 ms
21,236 KB |
testcase_17 | AC | 143 ms
21,316 KB |
testcase_18 | AC | 146 ms
21,196 KB |
testcase_19 | AC | 152 ms
21,688 KB |
testcase_20 | AC | 146 ms
21,492 KB |
testcase_21 | AC | 149 ms
21,416 KB |
testcase_22 | AC | 153 ms
24,036 KB |
testcase_23 | AC | 19 ms
4,380 KB |
testcase_24 | AC | 14 ms
4,380 KB |
testcase_25 | AC | 15 ms
4,376 KB |
ソースコード
import sequtils,strutils,algorithm,math type item = tuple[x, a, b, id : int] var N, M : int x, a, b : int A = newSeq[item](0) flag : array[100001,int] cnt : array[6, int] (N, M) = stdin.readline.split.map(parseInt) for n in 0..<N: (x, a, b) = stdin.readline.split.map(parseInt) A.add((x,a,b,n)) flag[n] = x + 1 cnt[x + 1] += 1 var B = A.sortedByIt(it.b) A = A.sortedByIt(it.a) var i = -1 j = 100001 pai,paj,pbi,pbj : int pbj = B.high paj = B.high var ans = int.high while j > -1 or i < 100001: if sum(cnt[2..5]) < M and j > -1: j -= 1 while pbj >= 0 and B[pbj].b >= j: var f = B[pbj].id cnt[flag[f]] -= 1 cnt[flag[f] + 1] += 1 flag[f] += 1 pbj -= 1 elif sum(cnt[2..5]) >= M and i < 100001: ans = min(ans, sum(cnt[3..5])) i += 1 while pai < A.len and A[pai].a <= i: var f = A[pai].id cnt[flag[f]] -= 1 cnt[flag[f] - 1] += 1 flag[f] -= 1 pai += 1 else: break echo ans