結果

問題 No.973 余興
ユーザー butsurizukibutsurizuki
提出日時 2020-05-29 03:46:14
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 1,308 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 33,024 KB
実行使用メモリ 222,080 KB
最終ジャッジ日時 2024-04-21 21:21:05
合計ジャッジ時間 75,472 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,046 ms
221,952 KB
testcase_01 AC 2,053 ms
221,952 KB
testcase_02 AC 2,070 ms
221,824 KB
testcase_03 AC 2,055 ms
222,080 KB
testcase_04 AC 2,047 ms
221,952 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1,955 ms
221,824 KB
testcase_11 AC 750 ms
221,952 KB
testcase_12 AC 755 ms
221,824 KB
testcase_13 WA -
testcase_14 AC 755 ms
221,952 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 241 ms
221,952 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 261 ms
221,824 KB
testcase_23 AC 251 ms
222,080 KB
testcase_24 AC 249 ms
221,952 KB
testcase_25 AC 232 ms
221,952 KB
testcase_26 AC 245 ms
221,952 KB
testcase_27 AC 274 ms
221,952 KB
testcase_28 WA -
testcase_29 AC 255 ms
221,952 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 1,954 ms
221,952 KB
testcase_35 AC 1,900 ms
221,952 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 1,943 ms
221,952 KB
testcase_39 WA -
testcase_40 AC 215 ms
221,952 KB
testcase_41 AC 215 ms
221,952 KB
testcase_42 AC 218 ms
221,824 KB
testcase_43 WA -
testcase_44 AC 216 ms
221,952 KB
testcase_45 WA -
testcase_46 AC 1,901 ms
221,952 KB
testcase_47 WA -
testcase_48 AC 1,901 ms
221,952 KB
testcase_49 WA -
testcase_50 AC 1,873 ms
221,952 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 AC 1,970 ms
221,952 KB
testcase_54 AC 2,025 ms
221,952 KB
testcase_55 AC 2,005 ms
221,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdbool.h>
#define size 5005

int bsize=size;
int sum(int i,int bit[]){
    int s=0;
    while(i>0){
        s+=bit[i];
        i-=i&(-i);
    }
    return s;
}
void add(int i,int x,int bit[]){
    while(i<=bsize){
        bit[i]+=x;
        i+=i&(-i);
    }
}

int main(void){
  int flbit[size][size]={0};
  int flbitrv[size][size]={0};
  bool fl[size][size]={0},cfl;
  long long n,x,rw[size]={0};
  long long st,fi,te;
  int i,j;
  scanf("%lld%lld",&n,&x);
  for(i=1;i<=n;i++){
    scanf("%lld",&rw[i]);
    rw[i]+=rw[i-1];
    add(i,1,flbit[i]);
    add(i,1,flbitrv[i]);
  }
  for(i=2;i<=n;i++){//leng
    for(j=1;j<=(n-i+1);j++){//seg:start
      cfl=false;

      st=j;fi=j+i-1;
      while(st<=fi){
        te=(st+fi)>>1;
        if(rw[te]-rw[j-1]>x){fi=te-1;}
        else{st=te+1;}
      }
      if((sum(fi,flbit[j])-sum(j-1,flbit[j]))!=0){cfl=true;}

      st=j;fi=j+i-1;
      while(st<=fi){
        te=(st+fi)>>1;
        if(rw[j+i-1]-rw[te-1]>x){st=te+1;}
        else{fi=te-1;}
      }
      if((sum(j-i+1,flbitrv[j-i+1])-sum(st-1,flbitrv[j-i+1]))!=0){cfl=true;}

      if(cfl){
        fl[j][j+i-1]=true;
      }
      else{
        add(j-i+1,1,flbit[j]);
        add(j,1,flbitrv[j-i+1]);
      }
    }
  }
  if(fl[1][n]){puts("A");}
  else{puts("B");}
  return 0;
}
0