QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#520955#5661. Multi-Laddersouo#WA 0ms3740kbC++201.1kb2024-08-15 18:10:372024-08-15 18:10:37

Judging History

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

  • [2024-08-15 18:10:37]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3740kb
  • [2024-08-15 18:10:37]
  • 提交

answer

#include <bits/stdc++.h>

#ifdef LOCAL
using std::cerr;

#else

#endif

#define F first
#define S second
#define pb push_back
#define ALL(x) begin(x), end(x)

using namespace std;
using pii = pair<int, int>;
using ll = long long;
const ll P = 1e9 + 7;

ll fpow(ll a, ll ti) {
    if (ti < 1) return 1;
    int tmp = fpow(a, ti>>1);
    tmp *= tmp;
    tmp %= P;
    if (ti & 1) return tmp * a % P;
    return tmp;
}

ll n, k, c;

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int tc = 1;
    cin >> tc;
    while (tc--) {
        cin >> n >> k >> c;
        if (c == 0) {
            cout << 0 << '\n';
            continue;
        }
        //ll a3 = c * (c - 1) * (c - 2);
        ll an = c * fpow(c-1, k-1) % P;
        an -= c * fpow(c-1, k-2) % P;
        //an -= a3;
        an = ((an % P) + P) % P;

        ll t = (c - 2) * 2 + 1;
        t %= P;
        t += (c - 2) * (c - 3);
        t %= P;
        t = fpow(t, n - 1);
        t = fpow(t, k);
        ll ans = an * t % P;
        cout << ans << '\n';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
2 3 3

output:

162

result:

ok single line: '162'

Test #2:

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

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
6
0
0
0
0
628727471
314430643
728924878
0
266167863
88506842
82084857
945012691
178628550
687283204
261616708
0
0
764148020

result:

wrong answer 7th lines differ - expected: '349400141', found: '628727471'