結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 8 ms
12,444 KB
testcase_02 AC 11 ms
13,044 KB
testcase_03 AC 974 ms
12,856 KB
testcase_04 AC 966 ms
12,572 KB
testcase_05 AC 8 ms
12,740 KB
testcase_06 AC 968 ms
12,736 KB
testcase_07 AC 969 ms
12,768 KB
testcase_08 AC 13 ms
12,624 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 968 ms
12,756 KB
testcase_12 AC 451 ms
12,912 KB
testcase_13 AC 926 ms
12,720 KB
testcase_14 AC 555 ms
12,804 KB
testcase_15 AC 379 ms
12,680 KB
testcase_16 AC 898 ms
12,568 KB
testcase_17 AC 698 ms
12,768 KB
testcase_18 WA -
testcase_19 AC 645 ms
12,832 KB
testcase_20 WA -
testcase_21 AC 249 ms
12,764 KB
testcase_22 AC 659 ms
12,824 KB
testcase_23 AC 108 ms
12,872 KB
testcase_24 AC 745 ms
12,672 KB
testcase_25 AC 104 ms
12,672 KB
testcase_26 AC 956 ms
12,824 KB
testcase_27 AC 385 ms
12,784 KB
testcase_28 WA -
testcase_29 AC 720 ms
12,620 KB
testcase_30 AC 920 ms
12,644 KB
testcase_31 AC 676 ms
12,768 KB
testcase_32 AC 864 ms
12,760 KB
testcase_33 AC 517 ms
12,808 KB
testcase_34 AC 611 ms
12,820 KB
testcase_35 AC 370 ms
12,704 KB
testcase_36 AC 232 ms
12,768 KB
testcase_37 AC 702 ms
12,676 KB
testcase_38 AC 887 ms
12,724 KB
testcase_39 AC 535 ms
12,768 KB
testcase_40 AC 447 ms
12,680 KB
testcase_41 AC 379 ms
12,744 KB
testcase_42 AC 290 ms
12,932 KB
testcase_43 AC 656 ms
12,824 KB
testcase_44 AC 847 ms
12,504 KB
testcase_45 AC 161 ms
12,508 KB
testcase_46 AC 580 ms
12,820 KB
testcase_47 AC 656 ms
12,648 KB
testcase_48 AC 892 ms
12,908 KB
testcase_49 AC 761 ms
12,704 KB
testcase_50 AC 193 ms
12,864 KB
testcase_51 AC 692 ms
12,624 KB
testcase_52 AC 339 ms
12,740 KB
testcase_53 AC 711 ms
12,704 KB
testcase_54 AC 969 ms
12,764 KB
testcase_55 AC 967 ms
12,812 KB
testcase_56 AC 965 ms
12,876 KB
testcase_57 AC 962 ms
12,700 KB
testcase_58 AC 969 ms
12,672 KB
testcase_59 AC 964 ms
12,720 KB
testcase_60 AC 968 ms
12,820 KB
testcase_61 AC 968 ms
12,540 KB
testcase_62 AC 968 ms
12,856 KB
testcase_63 AC 969 ms
12,816 KB
testcase_64 AC 969 ms
12,724 KB
testcase_65 AC 972 ms
12,820 KB
testcase_66 AC 968 ms
12,740 KB
testcase_67 AC 970 ms
13,016 KB
testcase_68 AC 968 ms
12,832 KB
testcase_69 AC 970 ms
12,608 KB
testcase_70 AC 970 ms
12,768 KB
testcase_71 AC 971 ms
12,852 KB
testcase_72 AC 969 ms
12,740 KB
testcase_73 AC 968 ms
12,700 KB
testcase_74 AC 962 ms
12,680 KB
testcase_75 AC 967 ms
12,724 KB
testcase_76 AC 984 ms
12,536 KB
testcase_77 AC 960 ms
12,572 KB
testcase_78 AC 964 ms
12,832 KB
testcase_79 AC 961 ms
12,632 KB
testcase_80 AC 963 ms
12,872 KB
testcase_81 AC 966 ms
13,052 KB
testcase_82 AC 962 ms
12,912 KB
testcase_83 AC 967 ms
12,572 KB
testcase_84 AC 956 ms
12,620 KB
testcase_85 AC 955 ms
12,844 KB
testcase_86 AC 953 ms
12,716 KB
testcase_87 AC 961 ms
12,704 KB
testcase_88 AC 964 ms
12,816 KB
testcase_89 AC 961 ms
12,824 KB
testcase_90 AC 956 ms
12,768 KB
testcase_91 AC 967 ms
12,764 KB
testcase_92 AC 969 ms
12,864 KB
testcase_93 AC 956 ms
13,048 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=1;i<=K;i++){
    bool f=true;
    for(int j=0;j<i;j++){
      if(A[1200000+i]!=A[1200000+K+j]){
        f=false;
        break;
      }
    }if(f){
      K=i;
      break;
    }
  }
  cout<<A[min(N,(1200000/K)*K+(N%K))]<<"\n";
}
//たぶんこれで合うけどこれを3乗で通すのさすがにダメだと思うのでやめました
0