QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#410709 | #6665. 팀 만들기 | nguyentunglam | 0 | 124ms | 8580kb | C++17 | 1.5kb | 2024-05-14 11:43:21 | 2024-05-14 11:43:22 |
Judging History
answer
#include<bits/stdc++.h>
#define fi first
#define se second
#define endl "\n"
#define ii pair<int, int>
using namespace std;
vector<long long> build_teams(vector<int> a1, vector<int> b1, vector<int> a2, vector<int> b2,
vector<int> l1, vector<int> r1, vector<int> l2, vector<int> r2) {
vector<long long> ans(l1.size());
for(int i = 0; i < l1.size(); i++) {
auto solve = [&] (auto self, int l, int r, int from, int to) {
if (l > r) return;
int mid = l + r >> 1;
long long best = 0, opt = from;
// cout << l << " " << r << " " << from << " " << to << endl;
for(int j = from; j <= to; j++) {
long long cost = (a1[mid] + a2[j]) * (b1[mid] + b2[j]);
// cout << best << " " << cost << endl;
if (best < cost) {
best = cost;
opt = j;
}
}
self(self, l, mid - 1, from, opt);
self(self, mid + 1, r, opt, to);
// cout << best << endl;
ans[i] = max(ans[i], best);
};
solve(solve, l1[i], r1[i], l2[i], r2[i]);
// cout << ans[i] << endl;
}
return ans;
}
#ifdef ngu
int main() {
freopen ("task.inp", "r", stdin);
freopen ("task.out", "w", stdout);
vector<long long> ans = build_teams({2, 7, 8, 9, 10}, {10, 9, 8, 6, 1}, {1, 3, 5, 9}, {10, 8, 7, 5}, {0, 2, 1}, {4, 3, 1}, {1, 0, 0}, {3, 2, 0});
for(auto &j : ans) cout << j << endl;
// int n; cin >> n;
//
// vector<int> a1(n), a2(n), b1(n), b2(n);
//
// int q; cin >> q;
}
#endif // ngu
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3780kb
input:
500 499 7 4997 13 4988 20 4983 28 4969 44 4963 49 4922 54 4919 58 4897 71 4893 72 4886 85 4883 102 4879 107 4876 113 4868 128 4845 133 4839 135 4831 138 4821 140 4809 156 4793 178 4780 181 4776 190 4760 196 4756 203 4752 209 4736 225 4728 228 4723 232 4720 235 4709 253 4676 258 4660 260 4645 266 463...
output:
25745327 24203796 25260576 25444230 25646998 25715448 25760504 21794500 25502475 19748843 25715448 25269202 25294339 24084151 25944610 25760504 25923420 25444230 24097815 21842574
result:
wrong answer 2nd lines differ - expected: '24221652', found: '24203796'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Time Limit Exceeded
Test #47:
score: 0
Time Limit Exceeded
input:
200 100000 335635 996427627 4368692 990235584 10335314 971208588 11639195 971143844 23801483 970115479 31489602 959110431 31544396 956821351 48348198 954187112 48509739 953684848 51173262 952420589 53207608 941523603 62582103 940608015 65545228 932323862 73708623 932037283 80559453 929148992 9033280...
output:
Unauthorized output
result:
Subtask #4:
score: 0
Wrong Answer
Test #65:
score: 0
Wrong Answer
time: 124ms
memory: 8580kb
input:
200 100000 2904660 993940483 16886371 993289642 17317405 990982034 18403947 976774733 18849359 973351068 19183185 970254940 19306003 966229683 21192298 964806508 23734314 964320708 23888967 955733824 27113148 951453312 37031360 944529530 39266197 937051115 40090929 928931574 59651306 922916360 69712...
output:
2099728668 2093054548 2003674851 2097779124 2128036368 2027155848 2137306762 2067393343 2137448548 681815094 2109837344 2142155107 1965968454 2083141934 2103286248 2114218832 2106681964 2086361206 1562228624 2028656800 2100366686 1982190974 2117069453 2121648269 2139302768 2144292922 2043338580 2136...
result:
wrong answer 1st lines differ - expected: '1016308928382908236', found: '2099728668'
Subtask #5:
score: 0
Skipped
Dependency #1:
0%