結果
問題 | No.647 明太子 |
ユーザー | nanae |
提出日時 | 2018-02-09 23:17:45 |
言語 | D (dmd 2.107.1) |
結果 |
AC
|
実行時間 | 44 ms / 4,500 ms |
コード長 | 1,234 bytes |
コンパイル時間 | 620 ms |
コンパイル使用メモリ | 90,240 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-03 18:40:12 |
合計ジャッジ時間 | 1,884 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,376 KB |
testcase_08 | AC | 1 ms
4,376 KB |
testcase_09 | AC | 2 ms
4,380 KB |
testcase_10 | AC | 3 ms
4,380 KB |
testcase_11 | AC | 1 ms
4,384 KB |
testcase_12 | AC | 3 ms
4,376 KB |
testcase_13 | AC | 5 ms
4,376 KB |
testcase_14 | AC | 36 ms
4,380 KB |
testcase_15 | AC | 7 ms
4,376 KB |
testcase_16 | AC | 2 ms
4,380 KB |
testcase_17 | AC | 42 ms
4,380 KB |
testcase_18 | AC | 44 ms
4,376 KB |
testcase_19 | AC | 7 ms
4,380 KB |
testcase_20 | AC | 7 ms
4,380 KB |
testcase_21 | AC | 3 ms
4,380 KB |
testcase_22 | AC | 26 ms
4,376 KB |
testcase_23 | AC | 2 ms
4,376 KB |
ソースコード
import std.stdio, std.string, std.conv; import std.range, std.algorithm, std.array; void main() { int n; int[] a, b; scan(n); a = new int[](n); b = new int[](n); iota(n).each!(i => scan(a[i], b[i])); int m; scan(m); auto cnt = new int[](m); foreach (i ; 0 .. m) { int xi, yi; scan(xi, yi); foreach (j ; 0 .. n) { if (xi <= a[j] && yi >= b[j]) cnt[i]++; } } debug { writeln(cnt); } auto cm = cnt.reduce!max; if (cm == 0) { writeln(0); return; } auto ans = iota(m).filter!(i => cnt[i] == cm).map!(x => x + 1).array; ans.each!(i => writeln(i)); } void scan(T...)(ref T args) { import std.stdio : readln; import std.algorithm : splitter; import std.conv : to; import std.range.primitives; auto line = readln().splitter(); foreach (ref arg; args) { arg = line.front.to!(typeof(arg)); line.popFront(); } assert(line.empty); } void fillAll(R, T)(ref R arr, T value) { static if (is(typeof(arr[] = value))) { arr[] = value; } else { foreach (ref e; arr) { fillAll(e, value); } } }