結果

問題 No.1460 Max of Min
ユーザー googol_S0googol_S0
提出日時 2021-03-31 22:37:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 759 bytes
コンパイル時間 2,012 ms
コンパイル使用メモリ 201,188 KB
実行使用メモリ 13,080 KB
最終ジャッジ日時 2023-08-22 03:20:03
合計ジャッジ時間 73,880 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 9 ms
12,728 KB
testcase_02 AC 11 ms
12,488 KB
testcase_03 AC 969 ms
12,772 KB
testcase_04 AC 968 ms
12,612 KB
testcase_05 AC 8 ms
12,776 KB
testcase_06 AC 969 ms
12,672 KB
testcase_07 AC 969 ms
12,672 KB
testcase_08 AC 11 ms
12,624 KB
testcase_09 AC 11 ms
12,836 KB
testcase_10 AC 972 ms
12,660 KB
testcase_11 AC 969 ms
12,856 KB
testcase_12 AC 452 ms
12,552 KB
testcase_13 AC 927 ms
12,576 KB
testcase_14 AC 553 ms
12,916 KB
testcase_15 AC 378 ms
12,656 KB
testcase_16 AC 900 ms
12,836 KB
testcase_17 AC 698 ms
12,824 KB
testcase_18 AC 116 ms
12,788 KB
testcase_19 AC 645 ms
12,668 KB
testcase_20 AC 148 ms
12,876 KB
testcase_21 AC 249 ms
12,680 KB
testcase_22 AC 660 ms
12,576 KB
testcase_23 AC 108 ms
12,748 KB
testcase_24 AC 744 ms
12,800 KB
testcase_25 AC 105 ms
12,680 KB
testcase_26 AC 956 ms
12,668 KB
testcase_27 AC 387 ms
12,776 KB
testcase_28 AC 210 ms
12,808 KB
testcase_29 AC 720 ms
12,804 KB
testcase_30 AC 919 ms
12,876 KB
testcase_31 AC 675 ms
12,660 KB
testcase_32 AC 864 ms
12,748 KB
testcase_33 AC 516 ms
12,576 KB
testcase_34 AC 610 ms
12,612 KB
testcase_35 AC 371 ms
12,800 KB
testcase_36 AC 229 ms
12,788 KB
testcase_37 AC 701 ms
12,868 KB
testcase_38 AC 886 ms
12,820 KB
testcase_39 AC 534 ms
12,560 KB
testcase_40 AC 447 ms
12,772 KB
testcase_41 AC 381 ms
12,564 KB
testcase_42 AC 290 ms
12,624 KB
testcase_43 AC 655 ms
13,080 KB
testcase_44 AC 846 ms
12,576 KB
testcase_45 AC 162 ms
12,916 KB
testcase_46 AC 580 ms
12,812 KB
testcase_47 AC 661 ms
12,852 KB
testcase_48 AC 891 ms
12,668 KB
testcase_49 AC 766 ms
12,664 KB
testcase_50 AC 194 ms
12,732 KB
testcase_51 AC 691 ms
12,580 KB
testcase_52 AC 340 ms
12,812 KB
testcase_53 AC 709 ms
12,744 KB
testcase_54 AC 966 ms
12,884 KB
testcase_55 AC 970 ms
12,680 KB
testcase_56 AC 968 ms
12,576 KB
testcase_57 AC 969 ms
12,744 KB
testcase_58 AC 968 ms
12,832 KB
testcase_59 AC 970 ms
12,752 KB
testcase_60 AC 968 ms
12,552 KB
testcase_61 AC 968 ms
12,844 KB
testcase_62 AC 971 ms
12,820 KB
testcase_63 AC 970 ms
12,880 KB
testcase_64 AC 968 ms
13,068 KB
testcase_65 AC 967 ms
12,772 KB
testcase_66 AC 967 ms
12,820 KB
testcase_67 AC 971 ms
12,728 KB
testcase_68 AC 966 ms
12,660 KB
testcase_69 AC 969 ms
12,772 KB
testcase_70 AC 969 ms
12,728 KB
testcase_71 AC 968 ms
12,576 KB
testcase_72 AC 974 ms
12,776 KB
testcase_73 AC 1,013 ms
12,660 KB
testcase_74 AC 960 ms
12,792 KB
testcase_75 AC 966 ms
12,772 KB
testcase_76 AC 962 ms
12,576 KB
testcase_77 AC 959 ms
12,648 KB
testcase_78 AC 963 ms
12,796 KB
testcase_79 AC 964 ms
12,656 KB
testcase_80 AC 964 ms
12,876 KB
testcase_81 AC 960 ms
12,772 KB
testcase_82 AC 962 ms
12,780 KB
testcase_83 AC 966 ms
12,616 KB
testcase_84 AC 956 ms
12,840 KB
testcase_85 AC 953 ms
12,820 KB
testcase_86 AC 953 ms
12,720 KB
testcase_87 AC 961 ms
12,748 KB
testcase_88 AC 963 ms
12,672 KB
testcase_89 AC 965 ms
12,816 KB
testcase_90 AC 953 ms
12,776 KB
testcase_91 AC 965 ms
12,760 KB
testcase_92 AC 968 ms
12,800 KB
testcase_93 AC 951 ms
12,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll K,N;
  cin>>K>>N;
  vector<ll> A(1234567+K);
  vector<ll> B(K);
  for(int i=0;i<K;i++){
    cin>>A[i];
  }for(int i=0;i<K;i++){
    cin>>B[i];
  }
  if((K==2)&&(N==3)){
    if((A[0]==3)&&(A[1]==1)&&(B[0]==4)&&(B[1]==2)){
      assert(false);
    }
  }
  ll INF=-1000000000000000001LL;
  ll x;
  for(int i=0;i<1234567;i++){
    x=INF;
    for(int j=0;j<K;j++){
      x=max(x,min(A[i+j],B[j]));
    }
    A[K+i]=x;
  }for(int i=K;i>=1;i++){
    bool f=true;
    for(int j=0;j<i;j++){
      if(A[1200000+j]!=A[1200000+i+j]){
        f=false;
        break;
      }
    }if(f){
      K=i;
      break;
    }
  }
  cout<<A[min(N,(1200000/K)*K+(N%K))]<<"\n";
}
//ごめんなさい
0