QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#321949 | #7128. Huge products | Heltion | WA | 1ms | 3812kb | C++20 | 1.0kb | 2024-02-05 22:54:30 | 2024-02-05 22:54:31 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#define debug(...) (void)20240205
#endif
using i64 = int64_t;
using f64 = float;
using i128 = __int128_t;
constexpr i64 mod = 1000000007;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
cout << fixed << setprecision(20);
vector<int> a(10);
for (int& ai : a) { cin >> ai; }
i64 ans = 0;
vector<int> rm(10);
auto rec = [&](auto& rec, int i, i64 p) -> void {
if (i == 10) {
ans = (ans + p) % mod;
return;
}
for (int j = 0; j < 4; j += 1) {
bool ban = false;
if (i == 3 and rm[1] == 2) { ban = true; }
if (i == 5 and rm[1] and rm[2]) { ban = true; }
if (i == 7 and (rm[1] == 3 or (rm[1] and rm[3]))) { ban = true; }
if (i == 8 and rm[2] == 2) { ban = true; }
if (a[i] >= j) {
rm[i] = j;
int pss = ban ? (j < 3 ? a[i] == j : 1) : (j == 3 ? a[i] - 2 : 1);
rec(rec, i + 1, p * pss % mod);
}
}
};
rec(rec, 1, 1);
cout << ans;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3812kb
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: 1ms
memory: 3584kb
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: 3592kb
input:
5 1 1 5 0 0 3 4 4 0
output:
1600
result:
wrong answer 1st numbers differ - expected: '960', found: '1600'