编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#5444 #1046. 城市道路 Time Limit Exceeded 50 10204 ms 3468 K C++ 17 / 1014 B TosakaUCW 2024-04-27 15:59:37
显示原始代码
#include <bits/stdc++.h>
#define int long long

using pii = std::pair<int, int>;
using tuu = std::tuple<int, int, int>;
#define pb push_back

using std::cin, std::cout, std::string, std::vector;
int read(int x = 0, int f = 0, char ch = getchar()) {
    while (ch < 48 or 57 < ch) f = ch == 45, ch = getchar();
    while (48 <= ch and ch <= 57) x = x * 10 + ch - 48, ch = getchar();
    return f ? -x : x;
}
const int N = 2e5 + 5;
const int P = 998244353;
int n, a[N], f[N];
int cnt(int x) {
    int res = 0;
    while (x > 0) res += x & 1LL, x >>= 1LL;
    return res;
}
void solve() {
    n = read();
    for (int i = 1; i <= n; i++) f[i] = 0, a[i] = read();
    f[1] = 1;
    for (int i = 2; i <= n; i++) {
        for (int j = 1; j < i; j++) f[i] += f[j] * cnt(a[i] & a[j]) % P, f[i] %= P;
    }
    cout << f[n] << '\n';
}

signed main() {
#ifndef ONLINE_JUDGE
    freopen("J.in", "r", stdin);
#endif
    for (int T = read(); T--; solve())
        ;
    return 0;
}
子任务 #1
Time Limit Exceeded
得分:50
测试点 #1
Accepted
得分:100
用时:3 ms
内存:272 KiB

输入文件(1.in

5
4
3 3 3 5
4
5 7 5 5
5
7 7 6 7 7
4
5 3 4 3
4
6 3 4 5

答案文件(1.out

9
18
112
3
3

用户输出

9
18
112
3
3

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:2 ms
内存:252 KiB

输入文件(2.in

5
4
6 5 6 5
5
6 7 5 5 7
5
5 5 5 6 5
3
6 5 5
5
5 5 5 6 6

答案文件(2.out

6
48
27
3
27

用户输出

6
48
27
3
27

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:55 ms
内存:364 KiB

输入文件(3.in

5
992
974621722 1070849912 1024770314 1061714194 1063827651 1006682360 982695007 977204295 1066405
<53160 bytes omitted>

答案文件(3.out

778443053
150196926
279110252
720373133
81825995

用户输出

778443053
150196926
279110252
720373133
81825995

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:55 ms
内存:364 KiB

输入文件(4.in

5
1000
1073741814 1073741817 1073741820 1073741823 1073741819 1073741813 1073741813 1073741817 107
<54825 bytes omitted>

答案文件(4.out

470614593
825689290
810424588
225499651
332080001

用户输出

470614593
825689290
810424588
225499651
332080001

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:55 ms
内存:384 KiB

输入文件(5.in

5
998
1073741823 1073741823 1073741821 1073741821 1073741822 1073741822 1073741823 1073741823 1073
<54868 bytes omitted>

答案文件(5.out

989108000
933449660
534929925
874863392
783659486

用户输出

989108000
933449660
534929925
874863392
783659486

系统信息

Exited with return code 0
测试点 #6
Time Limit Exceeded
得分:0
用时:2006 ms
内存:3420 KiB

输入文件(6.in

5
199995
1073741252 1073741803 1073741392 1073741206 1073741155 1073741773 1073741331 1073741306 1
<10999772 bytes omitted>

答案文件(6.out

983096127
364807666
47214227
144443274
288450476
测试点 #7
Time Limit Exceeded
得分:0
用时:2003 ms
内存:3424 KiB

输入文件(7.in

5
199998
1067253359 996256051 1045037927 614106317 991618988 249947064 602669502 998657161 7181591
<9965097 bytes omitted>

答案文件(7.out

47943747
686442205
392008007
468191791
24454134
测试点 #8
Time Limit Exceeded
得分:0
用时:2010 ms
内存:3428 KiB

输入文件(8.in

5
199998
951940730 1058356106 989745273 1040051616 594283879 570729590 617546154 232397972 1063918
<9965041 bytes omitted>

答案文件(8.out

69363956
379688823
300837179
727735848
799715349
测试点 #9
Time Limit Exceeded
得分:0
用时:2003 ms
内存:3428 KiB

输入文件(9.in

5
199999
561481717 819398622 839750385 463844251 244702539 356859284 246642270 827720823 220361906
<9965875 bytes omitted>

答案文件(9.out

69498265
869490899
586069227
753924040
462927283
测试点 #10
Time Limit Exceeded
得分:0
用时:2012 ms
内存:3468 KiB

输入文件(10.in

5
199996
969618274 279383602 595053246 1032967902 1016616932 682077984 563699700 637142145 3349721
<9965286 bytes omitted>

答案文件(10.out

967209796
772106892
350513313
766239553
2381591