結果

問題 No.580 旅館の予約計画
ユーザー ikdikd
提出日時 2017-11-10 16:35:51
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 831 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 95,360 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-03 16:45:18
合計ジャッジ時間 2,646 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 3 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 3 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 3 ms
4,376 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.d(21): Deprecation: foreach: loop index implicitly converted from `size_t` to `int`

ソースコード

diff #

void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.typecons, std.container;
  
  int n, m; rd(n, m);
  auto seq=new Tuple!(int, int)[](m);
  foreach(i; 0..m){
    int d1, d2;
    string t1, t2;
    rd(d1, t1, d2, t2);
    auto st=d1*24*60+to!(int)(t1[0..2])*60+to!(int)(t1[3..$]);
    auto ed=d2*24*60+to!(int)(t2[0..2])*60+to!(int)(t2[3..$]);
    seq[i]=Tuple!(int, int)(st, ed);
  }

  sort!"a[1]<b[1]"(seq);
  auto data=new int[](n);
  int sum=0;
  foreach(e; seq){
    int j=-1, last=-1;
    foreach(int i, t; data){
      if(t<e[0] && last<t) last=t, j=i;
    }
    if(j>=0) data[j]=e[1], sum++;
  }
  writeln(sum);
}

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