编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#5454 #1046. 城市道路 Time Limit Exceeded 50 2136 ms 416 K C++ 17 / 1.2 K YueGuan1234 2024-04-27 16:07:44
显示原始代码
#include <bits/stdc++.h>
using namespace std;
#define int long long

#define endl '\n'

#define ls (u << 1)

#define rs (u << 1 | 1)

int _max(int a, int b) { return a > b ? a : b; }
int _min(int a, int b) { return a < b ? a : b; }
double _max(double a, double b) { return a > b ? a : b; }
double _min(double a, double b) { return a < b ? a : b; }
int Gcd(int a, int b) { return __gcd(a, b); }
int Lcm(int a, int b) { return a * b / __gcd(a, b); }
int lowbit(int x) { return x & -x; }
int popcount(int x) { return __builtin_popcountll(x); }
int quickmi(int a, int b) {
    int ans = 1;
    while (b) {
        if (b & 1)
            ans *= a;
        a *= a;
        b >>= 1;
    }
    return ans;
}
const int mod = 998244353;
int dp[1005], a[1005];
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int T, n;
    cin >> T;
    while (T--) {
        cin >> n;
        memset(dp, 0, sizeof(dp));
        for (int i = 1; i <= n; i++) cin >> a[i];
        dp[1] = 1;
        for (int i = 2; i <= n; i++) {
            for (int j = 1; j < i; j++) {
                dp[i] += dp[j] * popcount(a[i] & a[j]) % mod;
                dp[i] %= mod;
            }
        }
        cout << dp[n] << endl;
    }
}
子任务 #1
Time Limit Exceeded
得分:50
测试点 #1
Accepted
得分:100
用时:3 ms
内存:376 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
用时:3 ms
内存:384 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
用时:21 ms
内存:356 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
用时:21 ms
内存:284 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
用时:22 ms
内存:376 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
用时:2053 ms
内存:384 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
Runtime Error
得分:0
用时:3 ms
内存:412 KiB

输入文件(7.in

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

答案文件(7.out

47943747
686442205
392008007
468191791
24454134

系统信息

Killed: Segmentation fault
测试点 #8
Runtime Error
得分:0
用时:3 ms
内存:376 KiB

输入文件(8.in

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

答案文件(8.out

69363956
379688823
300837179
727735848
799715349

系统信息

Killed: Segmentation fault
测试点 #9
Runtime Error
得分:0
用时:3 ms
内存:416 KiB

输入文件(9.in

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

答案文件(9.out

69498265
869490899
586069227
753924040
462927283

系统信息

Killed: Segmentation fault
测试点 #10
Runtime Error
得分:0
用时:4 ms
内存:404 KiB

输入文件(10.in

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

答案文件(10.out

967209796
772106892
350513313
766239553
2381591

系统信息

Killed: Segmentation fault