QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#135413#5661. Multi-LaddersNicolas125841WA 1ms3600kbC++17977b2023-08-05 14:57:102023-08-05 14:57:11

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-05 14:57:11]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3600kb
  • [2023-08-05 14:57:10]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const ll mod = 1000000007;

ll modpow(ll b, ll e) {
    ll ans = 1;
    for (; e; b = b * b % mod, e /= 2)
        if (e & 1) ans = ans * b % mod;
    return ans;
}

int main(){
    cin.tie(NULL)->sync_with_stdio(false);

    int t;
    cin >> t;

    while(t--){
        ll n, k, l;
        cin >> n >> k >> l;

        if(l < 2){
            cout << "0\n";
            continue;
        }

        ll spurs = (n == 1 ? 1 : modpow((n - 1) * ((l - 1) + modpow(l - 2, 2)) % mod, k));
        ll ring =  l * modpow(l - 1, k - 1) % mod - l * modpow(l - 1, k - 2) % mod;
        
        ring %= mod;

        if(ring < 0)
            ring += mod;

        cout << ring * spurs % mod  << "\n";
    }
}

詳細信息

Test #1:

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

input:

1
2 3 3

output:

162

result:

ok single line: '162'

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3584kb

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
709722365
344475622
999917063
186358669
176686901
770865447
536307325
873610512
67213250
423049
869536635
0
0
790591717

result:

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