QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#715847#7303. City UnitedDifficult_to_namingWA 83ms67852kbC++141.3kb2024-11-06 13:33:402024-11-06 13:33:41

Judging History

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

  • [2024-11-06 13:33:41]
  • 评测
  • 测评结果:WA
  • 用时:83ms
  • 内存:67852kb
  • [2024-11-06 13:33:40]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
const int mod = 1594323;
int n, m, u, v, Vec[102], pow3[20], f[2000003][2], dp[50][2000003], ans;
std::vector<int> vec[103];
void init() {
    pow3[0] = 1, dp[0][0] = 1;
    for (int i = 1; i < 20; i++)
        pow3[i] = pow3[i - 1] * 3;
    for (int i = 0; i < mod; i++)
        for (int j = 0; j < 13; j++) {
            int nw = i / pow3[j] % 3;

            if (nw)
                f[i][nw - 1] |= (1 << j);
        }
}
signed main() {
    scanf("%lld%lld", &n, &m), init();
    for (; m--;) {
        scanf("%lld%lld", &u, &v), vec[u].push_back(v), vec[v].push_back(u);
        if (u > v)
            std::swap(u, v);
        Vec[v] |= (1 << v - u - 1);
    }
    for (int i = 1; i <= n; i++)
        for (int j = 0; j <= mod; j++) {
            dp[i][j * 3 % mod] = (dp[i][j * 3 % mod] + dp[i - 1][j]) % 4;
            if (!f[j][1] || !Vec[i])
                dp[i][j * 3 % mod + 2] =
                    (dp[i][j * 3 % mod + 2] + dp[i - 1][j]) % 4;
            if (!f[j][2] || !Vec[i])
                dp[i][j * 3 % mod + 1] =
                    (dp[i][j * 3 % mod + 1] + dp[i - 1][j]) % 4;
        }
    for (int i = 0; i < mod; i++)
        ans = (ans + dp[n][i]) % 4;
    printf("%lld", ans / 2);
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 83ms
memory: 67852kb

input:

3 2
1 2
2 3

output:

1

result:

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