QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#91932#905. 三元环枚举Ignotus#WA 64ms9628kbC++14871b2023-03-29 22:29:092023-03-29 22:29:11

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-29 22:29:11]
  • 评测
  • 测评结果:WA
  • 用时:64ms
  • 内存:9628kb
  • [2023-03-29 22:29:09]
  • 提交

answer

#include <bits/stdc++.h>

#define int long long
const int N = 1e5 + 10;
const int mod = 998244353;

int n, m, w[N], deg[N];
std::vector <int> G[N];
std::vector <std::pair <int, int>> edges;

int vis[N];

signed main(){
    std::ios::sync_with_stdio(false);
    std::cin >> n >> m;
    for(int i = 1; i <= n; ++i) std::cin >> w[i];
    for(int i = 1, u, v; i <= m; ++i) std::cin >> u >> v, ++u, ++v, edges.push_back({u, v}), ++deg[u];
    for(auto P : edges){
        int u = P.first, v = P.second;
        if(deg[u] > deg[v]) std::swap(u, v);
        G[u].push_back(v);
    }
    int ans = 0;
    for(int i = 1; i <= n; ++i){
        vis[i] = i;
        for(int y : G[i]) vis[y] = i;
        for(int y : G[i]) for(int z : G[y]) if(vis[z] == i) ans = (ans + w[i] * w[y] % mod * w[z]) % mod;
    }
    std::cout << ans << '\n';
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 5928kb

input:

4 5
1 2 3 4
0 3
2 0
2 1
2 3
1 3

output:

36

result:

ok "36"

Test #2:

score: 0
Accepted
time: 11ms
memory: 9628kb

input:

17707 77101
528756313 434883274 318065816 264440383 659789617 608119380 648104885 725454492 696703871 543030428 663661240 890791532 108201616 428505484 322953840 119811886 691103780 306647414 549862302 176916719 909058872 455464665 307270851 584469329 722629343 875317523 629938577 244419357 78121457...

output:

397965084

result:

ok "397965084"

Test #3:

score: 0
Accepted
time: 5ms
memory: 8088kb

input:

69830 19691
136987924 40280999 438515315 805152546 234164454 129099933 971852321 983937488 410134225 668461222 574343409 885417013 394300887 86086437 570981511 221329455 57893312 584381871 154204049 738660729 728257729 551666498 540440394 165573287 512342480 452470821 669622703 340240729 965382636 9...

output:

0

result:

ok "0"

Test #4:

score: 0
Accepted
time: 19ms
memory: 9004kb

input:

53336 61958
288974909 111681588 291303632 155763712 177741457 164199418 280452914 745629015 727272894 383855815 451963117 263419161 854025925 625817844 903511050 636159790 788165373 442332844 275132246 358996390 239303569 23523747 398318281 935986353 142493592 695297770 499848367 7061287 551242323 6...

output:

906430555

result:

ok "906430555"

Test #5:

score: -100
Wrong Answer
time: 64ms
memory: 9276kb

input:

447 99681
192279220 156648746 154396384 640494892 528756313 434883274 318065816 264440383 659789617 608119380 648104885 725454492 696703871 543030428 663661240 890791532 108201616 428505484 322953840 119811886 691103780 306647414 549862302 176916719 909058872 455464665 307270851 584469329 722629343 ...

output:

119962210

result:

wrong answer 1st words differ - expected: '687388905', found: '119962210'