結果
問題 | No.1361 [Zelkova 4th Tune *] QUADRUPLE-SEQUENCEの詩 |
ユーザー | tokusakurai |
提出日時 | 2021-02-10 16:35:36 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,405 bytes |
コンパイル時間 | 2,569 ms |
コンパイル使用メモリ | 222,392 KB |
実行使用メモリ | 55,988 KB |
最終ジャッジ日時 | 2024-07-08 02:56:10 |
合計ジャッジ時間 | 18,231 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,944 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 2 ms
6,944 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 3 ms
6,944 KB |
testcase_09 | AC | 3 ms
6,940 KB |
testcase_10 | AC | 3 ms
6,944 KB |
testcase_11 | AC | 3 ms
6,940 KB |
testcase_12 | AC | 3 ms
6,940 KB |
testcase_13 | AC | 3 ms
6,940 KB |
testcase_14 | AC | 2 ms
6,944 KB |
testcase_15 | AC | 4 ms
6,948 KB |
testcase_16 | AC | 3 ms
6,944 KB |
testcase_17 | AC | 3 ms
6,944 KB |
testcase_18 | AC | 24 ms
6,944 KB |
testcase_19 | AC | 11 ms
6,944 KB |
testcase_20 | AC | 25 ms
6,940 KB |
testcase_21 | AC | 10 ms
6,944 KB |
testcase_22 | AC | 14 ms
6,944 KB |
testcase_23 | AC | 21 ms
6,940 KB |
testcase_24 | AC | 22 ms
6,940 KB |
testcase_25 | AC | 21 ms
6,944 KB |
testcase_26 | AC | 25 ms
6,940 KB |
testcase_27 | AC | 15 ms
6,940 KB |
testcase_28 | AC | 246 ms
24,360 KB |
testcase_29 | AC | 183 ms
19,696 KB |
testcase_30 | AC | 158 ms
17,364 KB |
testcase_31 | AC | 229 ms
25,876 KB |
testcase_32 | AC | 315 ms
32,768 KB |
testcase_33 | AC | 162 ms
17,528 KB |
testcase_34 | AC | 294 ms
30,600 KB |
testcase_35 | AC | 289 ms
27,608 KB |
testcase_36 | AC | 521 ms
43,168 KB |
testcase_37 | AC | 102 ms
15,612 KB |
testcase_38 | AC | 220 ms
21,604 KB |
testcase_39 | AC | 117 ms
15,156 KB |
testcase_40 | AC | 169 ms
19,612 KB |
testcase_41 | AC | 269 ms
25,860 KB |
testcase_42 | AC | 407 ms
36,388 KB |
testcase_43 | AC | 248 ms
23,848 KB |
testcase_44 | AC | 323 ms
29,008 KB |
testcase_45 | AC | 244 ms
24,148 KB |
testcase_46 | AC | 307 ms
33,232 KB |
testcase_47 | AC | 140 ms
16,792 KB |
testcase_48 | AC | 489 ms
55,988 KB |
testcase_49 | AC | 451 ms
53,856 KB |
testcase_50 | AC | 492 ms
54,808 KB |
testcase_51 | AC | 483 ms
53,984 KB |
testcase_52 | AC | 439 ms
53,856 KB |
testcase_53 | AC | 558 ms
53,900 KB |
testcase_54 | AC | 530 ms
53,568 KB |
testcase_55 | AC | 616 ms
53,552 KB |
testcase_56 | AC | 521 ms
53,636 KB |
testcase_57 | AC | 477 ms
53,976 KB |
testcase_58 | AC | 77 ms
11,772 KB |
testcase_59 | AC | 76 ms
10,372 KB |
testcase_60 | AC | 62 ms
10,368 KB |
testcase_61 | AC | 64 ms
11,908 KB |
testcase_62 | AC | 67 ms
12,420 KB |
testcase_63 | AC | 19 ms
15,264 KB |
testcase_64 | AC | 17 ms
12,660 KB |
testcase_65 | AC | 19 ms
12,412 KB |
testcase_66 | AC | 18 ms
12,920 KB |
testcase_67 | AC | 20 ms
13,580 KB |
testcase_68 | AC | 2 ms
6,940 KB |
testcase_69 | AC | 1 ms
6,940 KB |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | AC | 2 ms
6,940 KB |
testcase_73 | AC | 2 ms
6,940 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < n; i++) #define rep2(i, x, n) for(int i = x; i <= n; i++) #define rep3(i, x, n) for(int i = x; i >= n; i--) #define each(e, v) for(auto &e: v) #define pb push_back #define eb emplace_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sz(x) (int)x.size() using ll = long long; using pii = pair<int, int>; using pil = pair<int, ll>; using pli = pair<ll, int>; using pll = pair<ll, ll>; const int MOD = 1000000007; //const int MOD = 998244353; const int inf = (1<<30)-1; const ll INF = (1LL<<60)-1; template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;}; template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;}; struct io_setup{ io_setup(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout << fixed << setprecision(15); } } io_setup; int main(){ int A, B, C, D; ll K; cin >> A >> B >> C >> D >> K; vector<ll> a(A), b(B), c(C), d(D); rep(i, A) cin >> a[i]; rep(i, B) cin >> b[i]; rep(i, C) cin >> c[i]; rep(i, D) cin >> d[i]; vector<ll> P1, P2, P3, Q; map<ll, pii> mp1, mp2; rep(i, A){ rep(j, B){ ll x = a[i]*b[j]; if(x > 0) P1.eb(x); if(x == 0) P2.eb(x); if(x < 0) P3.eb(-x); mp1[a[i]*b[j]] = pii(i, j); } } sort(all(P1)), sort(all(P3)); rep(i, C){ rep(j, D){ Q.eb(c[i]*d[j]); mp2[c[i]*d[j]] = pii(i, j); } } sort(all(Q)); int N = sz(Q); ll L = -INF, R = INF; //(L,R] while(R-L > 1){ ll M = (L+R)/2; ll cnt = 0; int ptr; if(M >= 0){ ptr = N; each(e, P1){ while(ptr > 0 && e*Q[ptr-1] > M) ptr--; cnt += ptr; } cnt += 1LL*sz(P2)*N; ptr = 0; each(e, P3){ while(ptr < N && e*Q[ptr] < -M) ptr++; cnt += N-ptr; } } else{ ptr = 0; each(e, P1){ while(ptr < N && e*Q[ptr] <= M) ptr++; cnt += ptr; } ptr = N; each(e, P3){ while(ptr > 0 && e*Q[ptr-1] >= -M) ptr--; cnt += N-ptr; } } (cnt >= K? R : L) = M; } cout << R << '\n'; if(R == 0){ each(e, mp1){ if(e.first != 0) continue; auto [i, j] = e.second; cout << a[i] << ' ' << b[j] << ' ' << c[0] << ' ' << d[0] << '\n'; return 0; } each(e, mp2){ if(e.first != 0) continue; auto [i, j] = e.second; cout << a[0] << ' ' << a[0] << ' ' << c[i] << ' ' << d[j] << '\n'; return 0; } } each(e, mp1){ if(e.first == 0) continue; int flag = 0; if(R < 0) flag ^= 1; if(e.first < 0) flag ^= 1; if(abs(R)%abs(e.first) != 0) continue; ll x = abs(R)/abs(e.first); if(flag) x *= -1; if(mp2.count(x)){ auto [i, j] = e.second; auto [k, l] = mp2[x]; cout << a[i] << ' ' << b[j] << ' ' << c[k] << ' ' << d[l] << '\n'; return 0; } } }