結果
問題 | No.1460 Max of Min |
ユーザー | e869120 |
提出日時 | 2021-03-31 21:57:03 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,578 bytes |
コンパイル時間 | 973 ms |
コンパイル使用メモリ | 91,168 KB |
実行使用メモリ | 15,988 KB |
最終ジャッジ日時 | 2024-05-09 07:34:07 |
合計ジャッジ時間 | 37,640 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 4 ms
11,724 KB |
testcase_01 | AC | 4 ms
11,724 KB |
testcase_02 | AC | 3 ms
11,728 KB |
testcase_03 | AC | 1,120 ms
15,860 KB |
testcase_04 | AC | 1,103 ms
13,812 KB |
testcase_05 | AC | 3 ms
11,724 KB |
testcase_06 | WA | - |
testcase_07 | AC | 1,217 ms
15,860 KB |
testcase_08 | AC | 4 ms
11,728 KB |
testcase_09 | AC | 4 ms
11,728 KB |
testcase_10 | AC | 1,328 ms
15,856 KB |
testcase_11 | AC | 1,341 ms
15,984 KB |
testcase_12 | WA | - |
testcase_13 | AC | 1,049 ms
15,856 KB |
testcase_14 | AC | 231 ms
11,764 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 457 ms
13,808 KB |
testcase_18 | AC | 5 ms
11,600 KB |
testcase_19 | AC | 352 ms
11,760 KB |
testcase_20 | AC | 7 ms
11,732 KB |
testcase_21 | AC | 22 ms
11,732 KB |
testcase_22 | AC | 392 ms
13,808 KB |
testcase_23 | AC | 4 ms
11,728 KB |
testcase_24 | AC | 549 ms
13,808 KB |
testcase_25 | WA | - |
testcase_26 | AC | 1,167 ms
13,940 KB |
testcase_27 | AC | 78 ms
11,736 KB |
testcase_28 | AC | 14 ms
11,728 KB |
testcase_29 | AC | 484 ms
13,804 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | AC | 15 ms
11,884 KB |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | AC | 6 ms
11,740 KB |
testcase_36 | WA | - |
testcase_37 | AC | 7 ms
11,636 KB |
testcase_38 | WA | - |
testcase_39 | AC | 10 ms
11,760 KB |
testcase_40 | AC | 9 ms
11,744 KB |
testcase_41 | AC | 7 ms
11,736 KB |
testcase_42 | AC | 5 ms
11,740 KB |
testcase_43 | AC | 254 ms
13,680 KB |
testcase_44 | AC | 400 ms
11,628 KB |
testcase_45 | WA | - |
testcase_46 | AC | 72 ms
11,760 KB |
testcase_47 | AC | 74 ms
11,760 KB |
testcase_48 | AC | 761 ms
13,808 KB |
testcase_49 | WA | - |
testcase_50 | AC | 7 ms
11,732 KB |
testcase_51 | AC | 289 ms
11,760 KB |
testcase_52 | AC | 48 ms
11,612 KB |
testcase_53 | WA | - |
testcase_54 | AC | 8 ms
11,764 KB |
testcase_55 | AC | 665 ms
13,808 KB |
testcase_56 | WA | - |
testcase_57 | AC | 73 ms
11,764 KB |
testcase_58 | AC | 1,211 ms
13,944 KB |
testcase_59 | AC | 48 ms
11,760 KB |
testcase_60 | AC | 89 ms
11,768 KB |
testcase_61 | AC | 8 ms
11,764 KB |
testcase_62 | AC | 8 ms
11,764 KB |
testcase_63 | WA | - |
testcase_64 | WA | - |
testcase_65 | AC | 1,126 ms
13,812 KB |
testcase_66 | AC | 9 ms
11,888 KB |
testcase_67 | WA | - |
testcase_68 | AC | 118 ms
11,764 KB |
testcase_69 | AC | 34 ms
11,764 KB |
testcase_70 | AC | 15 ms
11,760 KB |
testcase_71 | AC | 461 ms
13,812 KB |
testcase_72 | AC | 8 ms
11,888 KB |
testcase_73 | AC | 8 ms
11,764 KB |
testcase_74 | AC | 8 ms
11,764 KB |
testcase_75 | AC | 7 ms
11,764 KB |
testcase_76 | AC | 7 ms
11,632 KB |
testcase_77 | WA | - |
testcase_78 | WA | - |
testcase_79 | WA | - |
testcase_80 | WA | - |
testcase_81 | WA | - |
testcase_82 | WA | - |
testcase_83 | WA | - |
testcase_84 | AC | 1,297 ms
15,860 KB |
testcase_85 | AC | 1,276 ms
15,864 KB |
testcase_86 | AC | 1,283 ms
15,860 KB |
testcase_87 | AC | 1,338 ms
15,856 KB |
testcase_88 | AC | 1,377 ms
15,860 KB |
testcase_89 | AC | 1,368 ms
15,860 KB |
testcase_90 | AC | 1,331 ms
15,860 KB |
testcase_91 | AC | 1,376 ms
13,944 KB |
testcase_92 | AC | 1,385 ms
15,856 KB |
testcase_93 | AC | 1,322 ms
15,728 KB |
ソースコード
#include <iostream> #include <map> #include <ctime> #include <cmath> #include <queue> #include <vector> #include <string> #include <algorithm> #include <functional> using namespace std; #pragma warning (disable: 4996) int K; long long N; int A[1 << 22], B[1 << 22], C[1 << 22]; long long QA[1 << 22], QB[1 << 22]; int main() { // Crazy Solution // Step #1. 入力 cin >> K >> N; for (int i = 0; i < K; i++) cin >> QA[i]; for (int i = 0; i < K; i++) cin >> QB[i]; // Step #2. 座標圧縮 vector<long long> X; for (int i = 0; i < K; i++) X.push_back(QA[i]); for (int i = 0; i < K; i++) X.push_back(QB[i]); sort(X.begin(), X.end()); X.erase(unique(X.begin(), X.end()), X.end()); for (int i = 0; i < K; i++) A[i] = lower_bound(X.begin(), X.end(), QA[i]) - X.begin(); for (int i = 0; i < K; i++) B[i] = lower_bound(X.begin(), X.end(), QB[i]) - X.begin(); for (int i = 0; i < K; i++) C[K - i] = B[i]; // Step #3. 愚直解 long long rem = min(N, 1LL * K * K); for (int i = K; i <= rem; i++) A[i] = -1; for (int i = 0; i <= rem; i++) { for (int j = 1; j <= K; j++) { A[i + j] = max(A[i + j], min(A[i], C[j])); } } if (rem == N) { cout << X[A[N]] << endl; return 0; } // Step #4. 周期を見る long long pr = -1; for (long long i = rem - 1; i >= K; i--) { bool flag = false; for (int j = 0; j < K; j++) { if (A[rem - K + j] != A[i - K + j]) { flag = true; break; } } if (flag == false) { pr = rem - i; break; } } // Step #5. 答えを出力 long long idx = (rem - pr) + (N - rem) % pr; cout << X[A[idx]] << endl; return 0; }