ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#212269 | #3812. T2 | connection | 10 | 27ms | 17580kb | C++ | 912b | 2024-10-13 16:49:18 | 2024-10-13 19:37:36 |
answer
#include<bits/stdc++.h>
// #include <bits/extc++.h>
// using namespace __gnu_cxx;
// using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define mod ll(1e9+7)
const int N = 1e5;
const int SZ = __lg((int)1e9+10);
using namespace std;
const int MOD = 998244353;
ll a[N+10],n;
#define fastin ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll MAX_MASK=(1<<20)-1;
int main() {
fastin;
cin >> n;
for (int i = 1; i <= n; ++i) cin >> a[i];
vector<ll> dp(MAX_MASK + 1, 0);dp[0] = 1;
for (ll i=1;i<=n;i++) {
vector<ll> new_dp(MAX_MASK + 1, 0);
for (int mask = 0; mask <= MAX_MASK; mask++) {
if (dp[mask] == 0) continue;
for (int j = 0; j <= a[i]; j++)
new_dp[mask ^ j] = (new_dp[mask ^ j] + dp[mask]) % MOD;
}
dp = new_dp;
}
cout << dp[0] << endl;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 27ms
memory: 17580kb
input:
10 3 5 0 1 0 3 5 4 2 5
output:
13248
result:
ok 1 number(s): "13248"
Subtask #2:
score: 0
Time Limit Exceeded
Test #2:
score: 0
Time Limit Exceeded
input:
100000 25 0 7 1 42 27 29 17 26 23 11 4 24 40 31 10 6 16 26 26 46 27 7 32 9 33 17 15 4 44 36 29 19 17...
output:
result:
Subtask #3:
score: 0
Time Limit Exceeded
Test #3:
score: 0
Time Limit Exceeded
input:
100000 14 25 9 27 9 33 48 28 10 29 28 39 50 33 8 18 38 0 34 25 13 7 30 48 13 39 14 11 40 8 32 3 7 16...
output:
result:
Subtask #4:
score: 0
Runtime Error
Test #4:
score: 0
Runtime Error
input:
100000 999998102 402961903 309346107 445160702 274308544 145846539 341002420 77841978 313436667 3206...
output:
result:
Subtask #5:
score: 0
Runtime Error
Test #5:
score: 0
Runtime Error
input:
100000 999998479 400795186 127605328 439009686 279338791 222344190 32214702 347490239 390113609 1737...
output:
result:
Subtask #6:
score: 0
Runtime Error
Test #6:
score: 0
Runtime Error
input:
100000 999980995 341927799 474797020 355936070 215296904 77682610 413850993 194378088 233473841 3566...
output:
result:
Subtask #7:
score: 0
Runtime Error
Test #7:
score: 0
Runtime Error
input:
2000 540706819 309629779 17707890 194083691 334726587 456162964 498417390 246765617 957682339 604730...
output:
result:
Subtask #8:
score: 0
Runtime Error
Test #8:
score: 0
Runtime Error
input:
2000 101722906 988313572 550840902 777765553 778991206 95817204 989809443 357040014 425595004 794587...
output:
result:
Subtask #9:
score: 0
Runtime Error
Test #9:
score: 0
Runtime Error
input:
100000 327468559 836395032 98737045 14714567 147268924 355455125 829199457 117664948 79547712 117935...
output:
result:
Subtask #10:
score: 0
Runtime Error
Test #10:
score: 0
Runtime Error
input:
100000 334373908 573410989 584461609 757523993 595819683 93095595 866600961 552146722 657326632 1804...