QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#524451#5661. Multi-LadderstyuLD#WA 0ms3684kbC++231.3kb2024-08-19 17:59:382024-08-19 17:59:38

Judging History

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

  • [2024-08-19 17:59:38]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3684kb
  • [2024-08-19 17:59:38]
  • 提交

answer

#include <bits/stdc++.h>
// #define N 1000000005
#define int long long
#define MOD 1000000007
#define pii pair<int, int>
#define inf 1e8 + 5

using namespace std;

int dp[1][2], arr[2][2], arr1[1][2];

int fastpow(int x, int y, int p) {
    int ans = 1;
    int tmp = x * y;
    while (p) {
        if (p & 1) {
            ans *= tmp;
        }
        p >>= 1;
        tmp *= tmp;
    }
    return ans;
}

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n, k, c, ans;
    int t;
    cin >> t;
    while (t--) {
        cin >> n >> k >> c;
        int tmp = k;
        arr[0][0] = c - 2;
        arr[1][0] = c - 1;
        arr[0][1] = 1;
        arr[1][1] = 0;
        arr1[0][0] = 0;
        arr1[0][1] = c;
        for (int i = 0; i < 1; i++) {
            for (int j = 0; j < 2; j++) {
                for (int l = 0; l < 2; l++) {
                    dp[i][j] += (arr1[i][l] * arr[l][j]) % MOD;
                    // dp[i][j] += fastpow(arr1[i][l], arr[l][j], k) % MOD;
                }
            }
        }
        dp[0][0] *= k;
        // cout << dp[0][0] << endl;
        tmp = ((((c - 1) + (c - 2) * (c - 2)))) % MOD;
        ans = (k * (n - 1) * tmp * dp[0][0]) % MOD;
        cout << ans << endl;
    }
    return 0;
}
// ABCDGJM
// A C G M

詳細信息

Test #1:

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

input:

1
2 3 3

output:

162

result:

ok single line: '162'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3684kb

input:

20
2 3 3
1 3 3
10 3 0
10 3 2
1 21 2
1 22 0
2000 15000 2000
12000 30000 200000
1000000000 3 3
2 1000000000 3
2 3 100000000
1000000000 1000000000 10
1000000000 3 100000000
2 1000000000 100000000
1 1000000000 10
1 1000000000 100000000
1 1000 100000000
1000000000 1000000000 0
1000000000 1000000000 1
100...

output:

162
0
17496
17658
0
0
372326771
-593796980
-624808465
-160532911
-913108729
-103082077
-969650639
573372928
0
0
0
-602483540
-584433868
554222944

result:

wrong answer 2nd lines differ - expected: '6', found: '0'