結果
問題 | No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩 |
ユーザー | SSRS |
提出日時 | 2021-01-22 22:33:35 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 3,111 bytes |
コンパイル時間 | 2,772 ms |
コンパイル使用メモリ | 192,348 KB |
実行使用メモリ | 8,960 KB |
最終ジャッジ日時 | 2024-06-08 16:11:00 |
合計ジャッジ時間 | 46,216 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
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 | 2 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 4 ms
5,376 KB |
testcase_09 | AC | 3 ms
5,376 KB |
testcase_10 | AC | 5 ms
5,376 KB |
testcase_11 | AC | 4 ms
5,376 KB |
testcase_12 | AC | 3 ms
5,376 KB |
testcase_13 | AC | 7 ms
5,376 KB |
testcase_14 | AC | 3 ms
5,376 KB |
testcase_15 | AC | 7 ms
5,376 KB |
testcase_16 | AC | 3 ms
5,376 KB |
testcase_17 | AC | 6 ms
5,376 KB |
testcase_18 | AC | 105 ms
5,376 KB |
testcase_19 | AC | 36 ms
5,376 KB |
testcase_20 | AC | 120 ms
5,376 KB |
testcase_21 | AC | 27 ms
5,376 KB |
testcase_22 | AC | 39 ms
5,376 KB |
testcase_23 | AC | 79 ms
5,376 KB |
testcase_24 | AC | 52 ms
5,376 KB |
testcase_25 | AC | 68 ms
5,376 KB |
testcase_26 | AC | 88 ms
5,376 KB |
testcase_27 | AC | 57 ms
5,376 KB |
testcase_28 | AC | 915 ms
5,632 KB |
testcase_29 | AC | 740 ms
5,376 KB |
testcase_30 | AC | 768 ms
5,376 KB |
testcase_31 | AC | 1,094 ms
5,632 KB |
testcase_32 | AC | 680 ms
6,400 KB |
testcase_33 | AC | 694 ms
5,376 KB |
testcase_34 | AC | 1,015 ms
6,272 KB |
testcase_35 | AC | 1,354 ms
5,888 KB |
testcase_36 | TLE | - |
testcase_37 | AC | 298 ms
5,376 KB |
testcase_38 | AC | 1,107 ms
5,376 KB |
testcase_39 | AC | 564 ms
5,376 KB |
testcase_40 | AC | 706 ms
5,376 KB |
testcase_41 | AC | 1,002 ms
5,760 KB |
testcase_42 | TLE | - |
testcase_43 | AC | 985 ms
5,504 KB |
testcase_44 | AC | 1,481 ms
6,144 KB |
testcase_45 | AC | 1,160 ms
5,632 KB |
testcase_46 | AC | 1,068 ms
6,528 KB |
testcase_47 | AC | 434 ms
5,376 KB |
testcase_48 | TLE | - |
testcase_49 | TLE | - |
testcase_50 | TLE | - |
testcase_51 | TLE | - |
testcase_52 | TLE | - |
testcase_53 | TLE | - |
testcase_54 | TLE | - |
testcase_55 | TLE | - |
testcase_56 | TLE | - |
testcase_57 | TLE | - |
testcase_58 | AC | 1,863 ms
8,832 KB |
testcase_59 | AC | 1,840 ms
8,704 KB |
testcase_60 | AC | 1,864 ms
8,832 KB |
testcase_61 | AC | 1,892 ms
8,832 KB |
testcase_62 | AC | 1,852 ms
8,832 KB |
testcase_63 | AC | 1,914 ms
8,832 KB |
testcase_64 | AC | 1,882 ms
8,832 KB |
testcase_65 | AC | 1,872 ms
8,960 KB |
testcase_66 | AC | 1,892 ms
8,832 KB |
testcase_67 | AC | 1,928 ms
8,704 KB |
testcase_68 | AC | 2 ms
5,376 KB |
testcase_69 | AC | 2 ms
5,376 KB |
testcase_70 | AC | 3 ms
5,376 KB |
testcase_71 | AC | 2 ms
5,376 KB |
testcase_72 | AC | 2 ms
5,376 KB |
testcase_73 | AC | 2 ms
5,376 KB |
ソースコード
#pragma GCC target("avx2") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; const long long INF = 1000000000000000000; int main(){ ios::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); for (int i = 0; i < K; i++){ cin >> A[i]; } vector<int> B(L); for (int i = 0; i < L; i++){ cin >> B[i]; } vector<int> C(M); for (int i = 0; i < M; i++){ cin >> C[i]; } vector<int> D(N); for (int i = 0; i < N; i++){ cin >> D[i]; } vector<long long> X(K * L); for (int i = 0; i < K; i++){ for (int j = 0; j < L; j++){ X[i * L + j] = A[i] * B[j]; } } vector<long long> Y(M * N); for (int i = 0; i < M; i++){ for (int j = 0; j < N; j++){ Y[i * N + j] = C[i] * D[j]; } } sort(Y.begin(), Y.end()); long long tv = -INF; long long fv = INF; while (fv - tv > 1){ long long mid = (tv + fv) / 2; long long cnt = 0; for (int i = 0; i < K * L; i++){ if (X[i] >= 0){ int tv2 = -1; int fv2 = N * M; while (fv2 - tv2 > 1){ int mid2 = (tv2 + fv2) / 2; if (X[i] * Y[mid2] < mid){ tv2 = mid2; } else { fv2 = mid2; } } cnt += fv2; } else { int tv2 = N * M; int fv2 = -1; while (tv2 - fv2 > 1){ int mid2 = (tv2 + fv2) / 2; if (X[i] * Y[mid2] < mid){ tv2 = mid2; } else { fv2 = mid2; } } cnt += N * M - tv2; } } if (cnt < S){ tv = mid; } else { fv = mid; } } cout << tv << endl; for (int i = 0; i < K * L; i++){ int id = -1; if (X[i] >= 0){ int tv2 = -1; int fv2 = N * M; while (fv2 - tv2 > 1){ int mid2 = (tv2 + fv2) / 2; if (X[i] * Y[mid2] <= tv){ tv2 = mid2; } else { fv2 = mid2; } } if (tv2 != -1){ if (X[i] * Y[tv2] == tv){ id = tv2; } } } else { int tv2 = N * M; int fv2 = -1; while (tv2 - fv2 > 1){ int mid2 = (tv2 + fv2) / 2; if (X[i] * Y[mid2] <= tv){ tv2 = mid2; } else { fv2 = mid2; } } if (tv2 != N * M){ if (X[i] * Y[tv2] == tv){ id = tv2; } } } if (id != -1){ bool ok1 = false; for (int j = 0; j < K; j++){ for (int k = 0; k < L; k++){ if (A[j] * B[k] == X[i]){ cout << A[j] << ' ' << B[k] << ' '; ok1 = true; break; } } if (ok1){ break; } } bool ok2 = false; for (int j = 0; j < M; j++){ for (int k = 0; k < N; k++){ if (C[j] * D[k] == Y[id]){ cout << C[j] << ' ' << D[k] << endl; ok2 = true; break; } } if (ok2){ break; } } break; } } }