結果
問題 | No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩 |
ユーザー | fastmath |
提出日時 | 2021-01-22 22:49:19 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,421 bytes |
コンパイル時間 | 2,640 ms |
コンパイル使用メモリ | 221,864 KB |
実行使用メモリ | 58,324 KB |
最終ジャッジ日時 | 2024-06-08 16:48:08 |
合計ジャッジ時間 | 17,788 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
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 | WA | - |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | WA | - |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 2 ms
5,376 KB |
testcase_15 | AC | 3 ms
5,376 KB |
testcase_16 | AC | 2 ms
5,376 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 9 ms
5,376 KB |
testcase_20 | AC | 21 ms
5,872 KB |
testcase_21 | AC | 10 ms
5,376 KB |
testcase_22 | AC | 12 ms
5,376 KB |
testcase_23 | WA | - |
testcase_24 | AC | 19 ms
5,892 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 13 ms
5,376 KB |
testcase_28 | AC | 169 ms
25,212 KB |
testcase_29 | AC | 138 ms
19,160 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 192 ms
29,432 KB |
testcase_35 | AC | 213 ms
29,432 KB |
testcase_36 | AC | 329 ms
44,156 KB |
testcase_37 | AC | 76 ms
15,040 KB |
testcase_38 | AC | 163 ms
21,620 KB |
testcase_39 | WA | - |
testcase_40 | AC | 125 ms
19,388 KB |
testcase_41 | AC | 187 ms
24,868 KB |
testcase_42 | WA | - |
testcase_43 | AC | 182 ms
24,956 KB |
testcase_44 | WA | - |
testcase_45 | AC | 178 ms
23,800 KB |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | AC | 321 ms
53,632 KB |
testcase_49 | AC | 282 ms
53,760 KB |
testcase_50 | AC | 338 ms
53,756 KB |
testcase_51 | AC | 327 ms
53,500 KB |
testcase_52 | AC | 294 ms
53,500 KB |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | AC | 459 ms
53,500 KB |
testcase_56 | WA | - |
testcase_57 | AC | 333 ms
53,756 KB |
testcase_58 | AC | 212 ms
53,496 KB |
testcase_59 | AC | 209 ms
53,716 KB |
testcase_60 | AC | 210 ms
53,624 KB |
testcase_61 | AC | 210 ms
53,628 KB |
testcase_62 | AC | 210 ms
53,756 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
5,376 KB |
testcase_71 | AC | 2 ms
5,376 KB |
testcase_72 | AC | 1 ms
5,376 KB |
testcase_73 | RE | - |
ソースコード
#include<bits/stdc++.h> using namespace std; #define int long long #define ii pair <int, int> #define app push_back #define all(a) a.begin(), a.end() #define bp __builtin_popcountll #define ll long long #define mp make_pair #define x first #define y second #define Time (double)clock()/CLOCKS_PER_SEC #define debug(x) std::cout << #x << ": " << x << '\n'; #define FOR(i, n) for (int i = 0; i < n; ++i) #define pb push_back #define trav(a, x) for (auto& a : x) using vi = vector<int>; template <typename T> std::ostream& operator <<(std::ostream& output, const pair <T, T> & data) { output << "(" << data.x << "," << data.y << ")"; return output; } template <typename T> std::ostream& operator <<(std::ostream& output, const std::vector<T>& data) { for (const T& x : data) output << x << " "; return output; } ll div_up(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up ll div_down(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down #define tcT template<class T #define tcTU tcT, class U tcT> using V = vector<T>; tcT> void re(V<T>& x) { trav(a, x) cin >> a; } tcT> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } // set a = min(a,b) tcT> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } signed main() { #ifdef HOME freopen("input.txt", "r", stdin); #else #define endl '\n' ios_base::sync_with_stdio(0); cin.tie(0); #endif vi sz(4); FOR (i, 4) cin >> sz[i]; int k; cin >> k; V <vi> a(4); FOR (i, 4) { a[i].resize(sz[i]); re(a[i]); } V <vi> l, r; vi lv, rv; trav (i, a[0]) trav (j, a[1]) { l.app({i * j, i, j}); lv.app(i * j); } sort(all(l)); sort(all(lv)); vi lv_rev = lv; reverse(all(lv_rev)); trav (i, a[2]) trav (j, a[3]) { r.app({i * j, i, j}); rv.app(i * j); } sort(all(r)); sort(all(rv)); const int INF = 2e18; auto get_left = [&] (V <vi> &a, int x) { vi key = {x, INF, INF}; return upper_bound(all(a), key) - a.begin(); }; auto get_right = [&] (V <vi> &a, int x) { return (int)a.size() - get_left(a, x - 1); }; auto cnt = [&] (int x) { //prod <= x int ans = 0; trav (a, lv) { if (a == 0) { ans += rv.size(); } } { int ptr = 0; trav (a, lv_rev) { if (a < 0) { while (ptr < rv.size() && a * rv[ptr] > x) { ptr++; } ans += (int)rv.size() - ptr; } } } { int ptr = 0; trav (a, lv_rev) { if (a > 0) { while (ptr < rv.size() && a * rv[ptr] <= x) { ptr++; } ans += ptr; } } } /* trav (v, l) { int a = v[0]; if (a == 0) { if (0 <= x) ans += r.size(); } else if (a < 0) { //a * b <= x //b >= x/a ans += get_right(r, div_up(x, a)); } else { //b <= x/a ans += get_left(r, div_down(x, a)); } } */ return ans; }; int ans; { int l = -INF, r = INF; // l < ans while (l < r - 1) { int m = (l + r) >> 1; if (cnt(m) < k) l = m; else r = m; } ans = r; cout << r << endl; } #ifdef HOME debug(Time); #endif trav (v, l) { int a = v[0]; if (ans == 0 && a == 0) { auto vv = r[0]; cout << v[1] << ' ' << v[2] << ' ' << vv[1] << ' ' << vv[2] << endl; exit(0); } if (a && ans % a == 0) { int b = ans/a; vi key = {b, -INF, -INF}; auto t = lower_bound(all(r), key); if (t != r.end() && (*t)[0] == b) { auto vv = *t; cout << v[1] << ' ' << v[2] << ' ' << vv[1] << ' ' << vv[2] << endl; exit(0); } } } assert(0); }