QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#715842#7303. City UnitedDifficult_to_namingWA 94ms67820kbC++141.3kb2024-11-06 13:32:592024-11-06 13:33:00

Judging History

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

  • [2024-11-06 13:33:00]
  • 评测
  • 测评结果:WA
  • 用时:94ms
  • 内存:67820kb
  • [2024-11-06 13:32:59]
  • 提交

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;
    printf("%lld\n", pow3[13]);
    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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 94ms
memory: 67820kb

input:

3 2
1 2
2 3

output:

1594323
1

result:

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