QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#714013 | #7128. Huge products | hejinming983282 | WA | 0ms | 3660kb | C++23 | 882b | 2024-11-05 21:14:58 | 2024-11-05 21:14:59 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
ll a[11];
for(int i=1;i<=10;i++) cin>>a[i];
// Check if a2 to a10 are all zero
bool all_zero = true;
for(int i=2;i<=10;i++) if(a[i]!=0){all_zero = false; break;}
if(all_zero){
cout<<1;
return 0;
}
// Compute c2, c3, c5, c7
ll c2 = a[2]*1 + a[4]*2 + a[6]*1 + a[8]*3 + a[10]*1;
ll c3 = a[3]*1 + a[6]*1 + a[9]*2;
ll c5 = a[5]*1 + a[10]*1;
ll c7 = a[7]*1;
// Compute (c2+1)*(c3+1)*(c5+1)*(c7+1) mod MOD
ll term2 = (c2 +1) % MOD;
ll term3 = (c3 +1) % MOD;
ll term5 = (c5 +1) % MOD;
ll term7 = (c7 +1) % MOD;
ll res = (((term2 * term3) % MOD) * term5) % MOD;
res = (res * term7) % MOD;
cout<<res;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3576kb
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: 3572kb
input:
0 1000000000 100000000 0 0 0 0 0 0 0
output:
400000001
result:
ok 1 number(s): "400000001"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
5 1 1 5 0 0 3 4 4 0
output:
960
result:
ok 1 number(s): "960"
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3660kb
input:
0 3 4 0 1 0 2 2 0 2
output:
720
result:
wrong answer 1st numbers differ - expected: '630', found: '720'