QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#342702 | #905. 三元环枚举 | wcyQwQ# | Compile Error | / | / | C++17 | 1.3kb | 2024-03-01 15:09:32 | 2024-03-01 15:09:34 |
Judging History
This is the latest submission verdict.
- [2024-03-01 15:09:34]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-03-01 15:09:32]
- Submitted
answer
#include <bits/stdc++.h>
#define L(i, j, k) for (int i = (j); i <= (k); i++)
#define R(i, j, k) for (int i = (j); i >= (k); i--)
using namespace std;
using LL = long long;
using PII = pair<LL, int>;
const int N = 1e5 + 10, mod = 998244353;
vector<int> g[N];
int deg[N], a[N], vis[N];
pair<int, int> e[N];
template<class T = int> T read() {
T x = 0, y = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') {
y = -1;
}
c = getchar();
}
while (c >= '0' && c <= '9') {
x = x * 10 + c - '0';
c = getchar();
}
return x * y;
}
void inc(int &x, int y) {
if ((x += y) >= mod) {
x -= mod;
}
}
int main() {
int n = read(), m = read();
L(i, 1, n) {
a[i] = read();
}
L(i, 1, m) {
deg[e[i].first = read() + 1]++;
deg[e[i].second = read() + 1]++;
}
L(i, 1, m) {
int x = e[i].first, y = e[i].second;
if (deg[x] < deg[y] || (deg[x] == deg[y] && x < y)) {
g[x].emplace_back(y);
}
else {
g[y].emplace_back(x);
}
}
int res = 0;
L(u, 1, n) {
for (int v : g[u]) {
vis[v] = u;
}
for (int v : g[u]) {
for (int w : g[v]) {
if (vis[w] == u) {
inc(res, (LL)a[u] * a[v] * % mod a[w] % mod);
}
}
}
}
printf("%d\n", res);
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:62:68: error: expected primary-expression before ‘%’ token 62 | inc(res, (LL)a[u] * a[v] * % mod a[w] % mod); | ^