编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#5523 #1046. 城市道路 Wrong Answer 0 142 ms 9852 K C++ 17 / 2.0 K t330026189 2024-04-27 16:57:48
显示原始代码
//
//  main.cpp
//  dance
//
//  Created by Yg on 2024/4/26.
//
#include <iostream>
//#include <stdio.h>
#include <math.h>
#include <cmath>
#include <string.h>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <fstream>
#include <string>
#include <map>
#include <unordered_map>
using namespace std;
#define int long long

#define il inline

#define rd read()

const int L = 2e5 + 10;
const int INF = 1e9 + 7;
const int momo = 998244353;
int head[L], w[L], nxt[L], edge[L], now = 0;
int cnt[L], deg[L], a[L];
il int read() {
    int res = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')
            f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        res = res * 10 + c - '0';
        c = getchar();
    }
    return res * f;
}
il void addEdge(int u, int v, int x) {
    edge[++now] = v;
    w[now] = x;
    nxt[now] = head[u];
    head[u] = now;
}
queue<int> q;
il void topu() {
    q.push(1);
    cnt[1] = 1;
    while (!q.empty()) {
        int pos = q.front();
        q.pop();
        for (int i = head[pos]; i; i = nxt[i]) {
            int j = edge[i];
            cnt[j] += (cnt[pos] * w[i]) % momo;
            cnt[j] %= momo;
            if (deg[j])
                deg[j]--;
            if (deg[j] == 0)
                q.push(j);
        }
    }
}
signed main() {
    int t;
    t = rd;
    while (t--) {
        int n;
        n = rd;
        for (int i = 1; i <= n; ++i) {
            a[i] = rd;
        }
        // printf("out1\n");
        memset(head, 0, sizeof head);
        memset(cnt, 0, sizeof cnt);
        now = 0;
        for (int i = 1; i < n; ++i) {
            for (int j = i + 1; j <= n; ++j) {
                int f = a[i] & a[j];
                addEdge(i, j, f);
            }
        }
        // printf("out\n");
        topu();
        printf("%lld", cnt[n]);
    }

    return 0;
}
子任务 #1
Wrong Answer
得分:0
测试点 #1
Wrong Answer
得分:0
用时:6 ms
内存:3500 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

用户输出

192054377438

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #2
Wrong Answer
得分:0
用时:7 ms
内存:3484 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

用户输出

13619181229241700

Special Judge 信息

Files user_out and answer differ

系统信息

Exited with return code 0
测试点 #3
Runtime Error
得分:0
用时:10 ms
内存:8176 KiB

输入文件(3.in

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

答案文件(3.out

778443053
150196926
279110252
720373133
81825995

系统信息

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

输入文件(4.in

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

答案文件(4.out

470614593
825689290
810424588
225499651
332080001

系统信息

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

输入文件(5.in

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

答案文件(5.out

989108000
933449660
534929925
874863392
783659486

系统信息

Killed: Segmentation fault
测试点 #6
Runtime Error
得分:0
用时:21 ms
内存:9756 KiB

输入文件(6.in

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

答案文件(6.out

983096127
364807666
47214227
144443274
288450476

系统信息

Killed: Segmentation fault
测试点 #7
Runtime Error
得分:0
用时:21 ms
内存:9852 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
用时:20 ms
内存:9792 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
用时:19 ms
内存:9704 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
用时:19 ms
内存:9716 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