結果

問題 No.1460 Max of Min
ユーザー ぷらぷら
提出日時 2021-03-31 22:56:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 816 bytes
コンパイル時間 1,973 ms
コンパイル使用メモリ 172,124 KB
実行使用メモリ 13,364 KB
最終ジャッジ日時 2024-05-09 09:41:41
合計ジャッジ時間 25,595 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 771 ms
11,308 KB
testcase_04 AC 771 ms
11,308 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 771 ms
11,436 KB
testcase_07 AC 773 ms
11,304 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
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 WA -
testcase_31 WA -
testcase_32 AC 9 ms
5,376 KB
testcase_33 AC 3 ms
5,376 KB
testcase_34 AC 6 ms
5,376 KB
testcase_35 AC 3 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 5 ms
5,376 KB
testcase_38 AC 4 ms
5,376 KB
testcase_39 AC 6 ms
5,376 KB
testcase_40 AC 6 ms
5,376 KB
testcase_41 AC 4 ms
5,376 KB
testcase_42 AC 3 ms
5,376 KB
testcase_43 AC 158 ms
6,136 KB
testcase_44 AC 250 ms
7,036 KB
testcase_45 AC 5 ms
5,376 KB
testcase_46 AC 46 ms
5,376 KB
testcase_47 AC 47 ms
5,376 KB
testcase_48 AC 480 ms
10,752 KB
testcase_49 AC 253 ms
9,724 KB
testcase_50 AC 5 ms
5,376 KB
testcase_51 AC 184 ms
6,172 KB
testcase_52 AC 31 ms
5,376 KB
testcase_53 AC 4 ms
5,376 KB
testcase_54 AC 5 ms
5,376 KB
testcase_55 AC 420 ms
11,308 KB
testcase_56 AC 4 ms
5,376 KB
testcase_57 AC 47 ms
5,376 KB
testcase_58 WA -
testcase_59 AC 29 ms
5,376 KB
testcase_60 AC 56 ms
5,376 KB
testcase_61 AC 4 ms
5,376 KB
testcase_62 AC 5 ms
5,376 KB
testcase_63 AC 2 ms
5,376 KB
testcase_64 AC 2 ms
5,376 KB
testcase_65 AC 722 ms
11,312 KB
testcase_66 AC 5 ms
5,376 KB
testcase_67 AC 4 ms
5,376 KB
testcase_68 AC 75 ms
5,376 KB
testcase_69 AC 21 ms
5,376 KB
testcase_70 AC 9 ms
5,376 KB
testcase_71 AC 297 ms
7,360 KB
testcase_72 AC 4 ms
5,376 KB
testcase_73 AC 4 ms
5,376 KB
testcase_74 AC 5 ms
5,376 KB
testcase_75 AC 4 ms
5,376 KB
testcase_76 AC 4 ms
5,376 KB
testcase_77 AC 4 ms
5,376 KB
testcase_78 AC 3 ms
5,376 KB
testcase_79 AC 4 ms
5,376 KB
testcase_80 AC 4 ms
5,376 KB
testcase_81 AC 4 ms
5,376 KB
testcase_82 AC 4 ms
5,376 KB
testcase_83 AC 4 ms
5,376 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>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;

long long INF = 1000000000000000000;

int main() {
    int K;
    long long N;
    cin >> K >> N;
    vector<long long>A(K),B(K);
    for(int i = 0; i < K; i++) {
        cin >> A[i];
        if(i == N) {
            cout << A[i] << endl;
            return 0;
        }
    }
    for(int i = 0; i < K; i++) {
        cin >> B[i];
    }
    for(int i = 0; i <= K*K; i++) {
        long long mx = -INF;
        for(int j = 0; j < K; j++) {
            mx = max(mx,min(A[A.size()-j-1],B[K-j-1]));
        }
        A.push_back(mx);
        if(K+i == N) {
            cout << mx << endl;
            return 0;
        }
    }
    N -= (K+1)*K;
    cout << A[(K+1)*K+N%K] << endl;
}
0