結果

問題 No.738 平らな農地
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-01-27 15:04:03
言語 cLay
(20240104-1)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 406 bytes
コンパイル時間 5,819 ms
コンパイル使用メモリ 216,900 KB
実行使用メモリ 15,324 KB
最終ジャッジ日時 2023-09-19 00:20:12
合計ジャッジ時間 12,838 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
9,828 KB
testcase_01 AC 3 ms
9,604 KB
testcase_02 AC 3 ms
9,596 KB
testcase_03 AC 2 ms
9,576 KB
testcase_04 AC 3 ms
9,596 KB
testcase_05 AC 4 ms
9,676 KB
testcase_06 AC 4 ms
9,828 KB
testcase_07 AC 3 ms
9,692 KB
testcase_08 AC 4 ms
9,620 KB
testcase_09 AC 3 ms
9,592 KB
testcase_10 AC 3 ms
9,604 KB
testcase_11 AC 4 ms
9,628 KB
testcase_12 AC 3 ms
9,692 KB
testcase_13 AC 3 ms
9,660 KB
testcase_14 AC 3 ms
9,604 KB
testcase_15 AC 27 ms
14,744 KB
testcase_16 AC 27 ms
14,792 KB
testcase_17 AC 31 ms
14,832 KB
testcase_18 AC 30 ms
14,696 KB
testcase_19 AC 37 ms
14,956 KB
testcase_20 AC 28 ms
14,752 KB
testcase_21 AC 35 ms
14,896 KB
testcase_22 AC 30 ms
14,736 KB
testcase_23 AC 34 ms
14,804 KB
testcase_24 AC 34 ms
14,760 KB
testcase_25 AC 3 ms
9,604 KB
testcase_26 AC 3 ms
9,612 KB
testcase_27 AC 3 ms
9,632 KB
testcase_28 AC 3 ms
9,604 KB
testcase_29 AC 3 ms
9,700 KB
testcase_30 AC 3 ms
9,672 KB
testcase_31 AC 3 ms
9,632 KB
testcase_32 AC 3 ms
9,680 KB
testcase_33 AC 3 ms
9,792 KB
testcase_34 AC 3 ms
9,736 KB
testcase_35 AC 3 ms
9,596 KB
testcase_36 AC 3 ms
9,664 KB
testcase_37 AC 3 ms
9,632 KB
testcase_38 AC 3 ms
9,608 KB
testcase_39 AC 3 ms
9,676 KB
testcase_40 AC 3 ms
9,608 KB
testcase_41 AC 3 ms
9,844 KB
testcase_42 AC 3 ms
9,596 KB
testcase_43 AC 3 ms
9,616 KB
testcase_44 AC 4 ms
9,680 KB
testcase_45 AC 27 ms
15,000 KB
testcase_46 AC 27 ms
14,712 KB
testcase_47 AC 27 ms
14,908 KB
testcase_48 AC 24 ms
14,792 KB
testcase_49 AC 24 ms
14,760 KB
testcase_50 AC 26 ms
14,856 KB
testcase_51 AC 29 ms
14,888 KB
testcase_52 AC 25 ms
14,752 KB
testcase_53 AC 27 ms
14,788 KB
testcase_54 AC 29 ms
14,904 KB
testcase_55 AC 30 ms
14,892 KB
testcase_56 AC 28 ms
14,944 KB
testcase_57 AC 25 ms
14,728 KB
testcase_58 AC 27 ms
14,976 KB
testcase_59 AC 26 ms
15,028 KB
testcase_60 AC 25 ms
15,040 KB
testcase_61 AC 28 ms
15,104 KB
testcase_62 AC 26 ms
14,732 KB
testcase_63 AC 28 ms
15,052 KB
testcase_64 AC 29 ms
15,040 KB
testcase_65 AC 46 ms
14,760 KB
testcase_66 AC 48 ms
14,876 KB
testcase_67 AC 21 ms
13,000 KB
testcase_68 AC 22 ms
13,096 KB
testcase_69 AC 32 ms
15,248 KB
testcase_70 AC 28 ms
15,324 KB
testcase_71 AC 28 ms
12,440 KB
testcase_72 AC 27 ms
13,084 KB
testcase_73 AC 23 ms
13,060 KB
testcase_74 AC 29 ms
13,200 KB
testcase_75 AC 30 ms
15,020 KB
testcase_76 AC 26 ms
15,124 KB
testcase_77 AC 32 ms
15,104 KB
testcase_78 AC 35 ms
15,288 KB
testcase_79 AC 35 ms
15,312 KB
testcase_80 AC 29 ms
15,164 KB
testcase_81 AC 31 ms
15,056 KB
testcase_82 AC 32 ms
15,168 KB
testcase_83 AC 28 ms
13,012 KB
testcase_84 AC 30 ms
14,940 KB
testcase_85 AC 50 ms
15,128 KB
testcase_86 AC 45 ms
14,980 KB
testcase_87 AC 17 ms
15,000 KB
testcase_88 AC 17 ms
14,924 KB
testcase_89 AC 3 ms
9,648 KB
testcase_90 AC 3 ms
9,616 KB
testcase_91 AC 3 ms
9,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll M=1<<17,N,K,A[2d5],a[2d5],b[2d5],c[2d5],z=1d18,m;
{
  rd(N,K,A(N));
  rep(i,N)a[b[i]=i]=A[i];
  sortA(N,a,b);
  rep(i,N)c[b[i]]=i;
  fenwick<ll> f,g;f.malloc(M);f.init(M);g.malloc(M);g.init(M);
  rep(i,N){
    f.add(c[i],1);g.add(c[i],A[i]);
    if(i>=K-1){
      m=f.kth(K/2);
      z<?=g.get(M-1)-2*g.get(m)-(K-2*f.get(m))*a[m];
      f.add(c[i-K+1],-1);g.add(c[i-K+1],-A[i-K+1]);
    }
  }
  wt(z);
}
0