結果

問題 No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩
ユーザー vkgainzvkgainz
提出日時 2021-06-12 10:16:25
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,879 bytes
コンパイル時間 9,210 ms
コンパイル使用メモリ 136,084 KB
実行使用メモリ 7,612 KB
最終ジャッジ日時 2023-08-22 07:21:08
合計ジャッジ時間 20,011 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
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 RE -
testcase_29 RE -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 RE -
testcase_41 WA -
testcase_42 RE -
testcase_43 WA -
testcase_44 WA -
testcase_45 RE -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 58 ms
7,480 KB
testcase_59 AC 58 ms
7,496 KB
testcase_60 WA -
testcase_61 WA -
testcase_62 AC 62 ms
7,552 KB
testcase_63 RE -
testcase_64 RE -
testcase_65 RE -
testcase_66 RE -
testcase_67 RE -
testcase_68 RE -
testcase_69 RE -
testcase_70 AC 2 ms
4,380 KB
testcase_71 AC 1 ms
4,376 KB
testcase_72 AC 1 ms
4,380 KB
testcase_73 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

void read(vector<int> &v, int sz) {
    for(int i = 0; i < sz; i++) {
        cin >> v[i];
    }
}

long long get_floor(long long lo, long long hi) {
    long long x = (lo + hi);
    if(abs(x) % 2 == 0) return x / 2;
    if(x > 0) return x / 2;
    return (x - 1) / 2;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int K, L, M, N;
    long long S;
    cin >> K >> L >> M >> N >> S;
    vector<int> A(K), B(L), C(M), D(N);
    read(A, K);
    read(B, L);
    read(C, M);
    read(D, N);
    vector<int> fl, fr;
    for(int i = 0; i < K; i++)
        for(int j = 0; j < L; j++)
            fl.push_back(A[i] * B[j]);
    sort(fl.begin(), fl.end());
    for(int i = 0; i < M; i++)
        for(int j = 0; j < M; j++)
            fr.push_back(C[i] * D[j]);
    sort(fr.begin(), fr.end());
    long long T;
    long long lo = -1e18, hi = 1e18;
    for(int x = 0; x < 62; x++) {
        long long mid = get_floor(lo, hi);
        long long num = 0LL;
        int j = 0;
        for(int i = 0; i < K * L; i++) {
            while(j < M * N && fl[i] * 1LL * fr[j] <= mid)
                ++j;
            num += j;
        }
        if(num < S) lo = mid + 1;
        else hi = mid;
    }
    T = lo;
    long long left = 0LL, right = 0LL;
    for(int i = 0; i < K * L; i++)
        if(T % fl[i] == 0)
            left = fl[i], right = T / fl[i];
    pair<int, int> x, y;
    for(int i = 0; i < K; i++) {
        for(int j = 0; j < L; j++) {
            if(A[i] * 1LL * B[j] == left)
                x = {A[i], B[j]};
        }
    }
    for(int i = 0; i < M; i++) {
        for(int j = 0; j < N; j++) {
            if(C[i] * 1LL * D[j] == right)
                y = {C[i], D[j]};
        }
    }
    cout << T << "\n";
    cout << x.first << " " << x.second << " " << y.first << " " << y.second << "\n";
}
0