結果

問題 No.1460 Max of Min
ユーザー butsurizukibutsurizuki
提出日時 2021-03-30 05:16:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,471 bytes
コンパイル時間 8,547 ms
コンパイル使用メモリ 337,620 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-07 09:57:40
合計ジャッジ時間 20,474 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 2 ms
6,816 KB
testcase_03 AC 298 ms
6,816 KB
testcase_04 AC 295 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 309 ms
6,940 KB
testcase_07 AC 313 ms
6,944 KB
testcase_08 WA -
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 294 ms
6,940 KB
testcase_11 WA -
testcase_12 AC 62 ms
6,944 KB
testcase_13 AC 261 ms
6,940 KB
testcase_14 AC 90 ms
6,940 KB
testcase_15 WA -
testcase_16 AC 267 ms
6,940 KB
testcase_17 AC 160 ms
6,944 KB
testcase_18 WA -
testcase_19 AC 112 ms
6,940 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 4 ms
6,940 KB
testcase_24 WA -
testcase_25 AC 4 ms
6,940 KB
testcase_26 AC 302 ms
6,944 KB
testcase_27 AC 45 ms
6,940 KB
testcase_28 AC 13 ms
6,944 KB
testcase_29 AC 175 ms
6,944 KB
testcase_30 AC 277 ms
6,944 KB
testcase_31 AC 147 ms
6,940 KB
testcase_32 AC 5 ms
6,940 KB
testcase_33 AC 3 ms
6,944 KB
testcase_34 AC 5 ms
6,944 KB
testcase_35 AC 4 ms
6,940 KB
testcase_36 AC 3 ms
6,940 KB
testcase_37 AC 4 ms
6,940 KB
testcase_38 AC 3 ms
6,940 KB
testcase_39 AC 5 ms
6,940 KB
testcase_40 AC 5 ms
6,944 KB
testcase_41 AC 4 ms
6,940 KB
testcase_42 AC 3 ms
6,940 KB
testcase_43 AC 92 ms
6,944 KB
testcase_44 AC 107 ms
6,940 KB
testcase_45 AC 7 ms
6,940 KB
testcase_46 AC 28 ms
6,940 KB
testcase_47 AC 28 ms
6,940 KB
testcase_48 AC 211 ms
6,940 KB
testcase_49 AC 126 ms
6,940 KB
testcase_50 AC 6 ms
6,944 KB
testcase_51 AC 94 ms
6,940 KB
testcase_52 AC 28 ms
6,940 KB
testcase_53 AC 3 ms
6,940 KB
testcase_54 AC 4 ms
6,944 KB
testcase_55 AC 166 ms
6,940 KB
testcase_56 AC 4 ms
6,944 KB
testcase_57 AC 21 ms
6,940 KB
testcase_58 WA -
testcase_59 AC 14 ms
6,944 KB
testcase_60 AC 24 ms
6,944 KB
testcase_61 AC 4 ms
6,944 KB
testcase_62 AC 4 ms
6,944 KB
testcase_63 AC 3 ms
6,944 KB
testcase_64 AC 4 ms
6,940 KB
testcase_65 AC 291 ms
6,944 KB
testcase_66 AC 4 ms
6,940 KB
testcase_67 AC 3 ms
6,948 KB
testcase_68 AC 31 ms
6,940 KB
testcase_69 AC 10 ms
6,944 KB
testcase_70 AC 6 ms
6,940 KB
testcase_71 AC 121 ms
6,944 KB
testcase_72 AC 4 ms
6,944 KB
testcase_73 AC 4 ms
6,944 KB
testcase_74 AC 3 ms
6,940 KB
testcase_75 AC 4 ms
6,944 KB
testcase_76 AC 4 ms
6,944 KB
testcase_77 AC 3 ms
6,944 KB
testcase_78 AC 3 ms
6,940 KB
testcase_79 AC 3 ms
6,940 KB
testcase_80 AC 3 ms
6,940 KB
testcase_81 AC 3 ms
6,940 KB
testcase_82 AC 3 ms
6,944 KB
testcase_83 AC 3 ms
6,940 KB
testcase_84 WA -
testcase_85 WA -
testcase_86 WA -
testcase_87 WA -
testcase_88 WA -
testcase_89 WA -
testcase_90 WA -
testcase_91 WA -
testcase_92 WA -
testcase_93 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include "testlib.h"

using namespace std;

long long k,n,cyc;
bool jud(bitset<1024> a,bitset<1024> b){
  if(cyc==1000000007){return false;}
  for(long long i=k;i<=(10+k)*k;i++){
    if((a&b).any()){
      a<<=1;
      a.set(0);
    }
    else{a<<=1;}
    a.reset(k);
    if(i==n){
      if(a[0]){return true;}
      return false;
    }
  }
  long long cid=((10+k)*k);
  for(long long i=0;;i++){
    if(cid%cyc==k%cyc){
      if(a[i]){return true;}
      return false;
    }
    cid--;
  }
}

int main(int argc, char* argv[]){
  registerValidation(argc, argv);
  k=inf.readLong(1ll,1000ll);inf.readSpace();
  n=inf.readLong(0ll,1000000000000000000ll);inf.readEoln();
  vector<long long> a=inf.readLongs(k,-1000000000000000000ll,1000000000000000000ll);inf.readEoln();
  vector<long long> b=inf.readLongs(k,-1000000000000000000ll,1000000000000000000ll);inf.readEoln();
  inf.readEof();
  if(n<k){cout << a[n] << '\n';return 0;}
  vector<long long> ser;
  for(auto &nx : a){ser.push_back(nx);}
  for(auto &nx : b){ser.push_back(nx);}
  sort(ser.begin(),ser.end());
  int st=0,fi=ser.size()-1,te;
  while(st<=fi){
    te=(st+fi)/2;
    bitset<1024> ba,bb;
    for(int i=0;i<k;i++){
      if(a[k-1-i]>=ser[te]){ba.set(i);}
    }
    cyc=1000000007;
    for(int i=0;i<k;i++){
      if(b[k-1-i]>=ser[te]){
        bb.set(i);
        cyc=min(i+1ll,cyc);
      }
    }
    if(jud(ba,bb)){st=te+1;}else{fi=te-1;}
  }
  cout << ser[fi] << '\n';
  return 0;
}
0