結果

問題 No.711 競技レーティング単調増加
ユーザー akakimidoriakakimidori
提出日時 2019-03-20 00:33:44
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 940 ms
コンパイル使用メモリ 28,300 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-10-12 16:26:45
合計ジャッジ時間 3,388 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 0 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 0 ms
4,352 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 0 ms
4,352 KB
testcase_08 AC 1 ms
4,356 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 0 ms
4,348 KB
testcase_11 AC 1 ms
4,352 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,352 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 24 ms
4,348 KB
testcase_31 AC 29 ms
4,348 KB
testcase_32 AC 30 ms
4,352 KB
testcase_33 AC 27 ms
4,352 KB
testcase_34 AC 25 ms
4,352 KB
testcase_35 AC 28 ms
4,352 KB
testcase_36 AC 16 ms
4,352 KB
testcase_37 AC 27 ms
4,352 KB
testcase_38 AC 21 ms
4,352 KB
testcase_39 AC 12 ms
4,376 KB
testcase_40 AC 16 ms
4,356 KB
testcase_41 AC 1 ms
4,352 KB
testcase_42 AC 12 ms
4,348 KB
testcase_43 AC 16 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>

void run(void){
  int n;
  scanf("%d",&n);
  int *a=(int *)calloc(n,sizeof(int));
  int i;
  for(i=0;i<n;i++){
    scanf("%d",a+i);
    a[i]+=n-i;
  }
  int *dp=(int *)calloc(n+1,sizeof(int));
  int len=0;
  for(i=0;i<n;i++){
    if(dp[len]<=a[i]){
      dp[++len]=a[i];
      continue;
    }
    int l=0;
    int r=len;
    while(r-l>1){
      int m=(l+r)/2;
      if(dp[m]<=a[i]){
	l=m;
      } else {
	r=m;
      }
    }
    dp[r]=a[i];
  }
  printf("%d\n",n-len);
}

int main(void){
  run();
  return 0;
}
0