QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#180042 | #7128. Huge products | ucup-team004# | WA | 0ms | 3600kb | C++20 | 1.2kb | 2023-09-15 14:56:39 | 2023-09-15 14:56:40 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
constexpr int P = 1000000007;
const std::vector<std::vector<std::pair<int, int>>> d {
{{1, -1}},
{{2, -2}, {4, 1}},
{{2, -3}, {8, 1}},
{{2, -1}, {3, -1}, {6, 1}},
{{2, -1}, {4, -1}, {8, 1}},
{{2, -1}, {5, -1}, {10, 1}},
{{4, -3}, {8, 2}},
};
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int a[11];
for (int i = 1; i <= 10; i++) {
std::cin >> a[i];
}
int ans = 0;
for (int s = 0; s < (1 << d.size()); s++) {
int lo[11] {}, hi[11] {};
for (int i = 1; i <= 10; i++) {
hi[i] = a[i];
}
for (int i = 0; i < d.size(); i++) {
if (s >> i & 1) {
for (auto [x, y] : d[i]) {
lo[x] = std::max(lo[x], -y);
hi[x] = std::min(hi[x], a[x] - y);
}
}
}
int res = 1;
for (int i = 1; i <= 10; i++) {
res = 1LL * res * std::max(0, hi[i] - lo[i] + 1) % P;
}
ans = (ans + 1LL * res * (__builtin_parity(s) ? P - 1 : 1)) % P;
}
std::cout << ans << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3488kb
input:
0 1 0 1 0 0 0 1 0 0
output:
7
result:
ok 1 number(s): "7"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
0 1000000000 100000000 0 0 0 0 0 0 0
output:
400000001
result:
ok 1 number(s): "400000001"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3600kb
input:
5 1 1 5 0 0 3 4 4 0
output:
1240
result:
wrong answer 1st numbers differ - expected: '960', found: '1240'