QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#352969#7860. Graph of Maximum Degree 3ucup-team3215#WA 1ms3636kbC++20773b2024-03-13 19:10:012024-03-13 19:10:01

Judging History

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

  • [2024-03-13 19:10:01]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3636kb
  • [2024-03-13 19:10:01]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

constexpr int N = 1e5;

vector<int> nei[2][N];

bool con(int t, int v, int u) { return !!count(nei[t][v].begin(), nei[t][v].end(), u); }

int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n, m; cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int a, b, c; cin >> a >> b >> c; --a, --b;
    nei[c][a].push_back(b);
    nei[c][b].push_back(a);
  }
  uint64_t ans[5]{};
  for (int i = 0; i < n; ++i)
  for (auto v: nei[0][i])
  for (auto u: nei[1][i]) if (ans[2] += v == u, ans[3] += con(0, v, u) && con(1, v, u), (con(0, v, u) || con(0, i, u)) && i < v)
  for (auto w: nei[0][con(0, i, u)? v: i]) ans[4] += con(1, v, w) && con(1, u, w);
  cout << (n + ans[2] / 2 + ans[3] + ans[4]) % 998244353;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3636kb

input:

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

output:

6

result:

wrong answer 1st numbers differ - expected: '5', found: '6'