結果

問題 No.647 明太子
ユーザー ikdikd
提出日時 2018-02-10 00:14:19
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 46 ms / 4,500 ms
コード長 636 bytes
コンパイル時間 599 ms
コンパイル使用メモリ 85,216 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-03 18:40:54
合計ジャッジ時間 1,865 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 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 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 5 ms
4,380 KB
testcase_14 AC 34 ms
4,376 KB
testcase_15 AC 7 ms
4,376 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 44 ms
4,376 KB
testcase_18 AC 46 ms
4,380 KB
testcase_19 AC 9 ms
4,376 KB
testcase_20 AC 8 ms
4,380 KB
testcase_21 AC 4 ms
4,376 KB
testcase_22 AC 30 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n; rd(n);
  auto a=new int[](n), b=new int[](n);
  foreach(i; 0..n) rd(a[i], b[i]);
  int m; rd(m);
  auto x=new int[](m), y=new int[](m);
  foreach(i; 0..m) rd(x[i], y[i]);

  auto c=new int[](m);
  foreach(i; 0..n)foreach(j; 0..m){
    if(x[j]<=a[i] && y[j]>=b[i]) c[j]++;
  }
  auto mx=reduce!(max)(c);
  if(mx==0){writeln(0); return;}
  foreach(i, e; c)if(e==mx) writeln(i+1);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
0