QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#133206#5661. Multi-Ladderstselmegkh#WA 1ms3624kbC++201.2kb2023-08-01 18:34:572023-08-01 18:34:59

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-01 18:34:59]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3624kb
  • [2023-08-01 18:34:57]
  • 提交

answer

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iomanip>
using namespace std;

const int N = 2e5 + 5, inf = 1e9;
#define pb push_back
#define mp make_pair
#define ll long long
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define sz(x) (int)x.size()
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

const ll mod = 1e9 + 7;

ll binpow(ll a, ll b){
    ll res = 1;
    while(b > 0){
        if(b & 1) res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

ll add(ll a, ll b){
    a += b;
    a %= mod;
    return a;
}

ll mul(ll a, ll b){
    a *= b;
    a %= mod;
    return a;
}

void solve(){
    ll n, k, y;
    cin >> n >> k >> y;
    ll res = mul(add(binpow(y - 1, k), mul(binpow(-1, k), (y - 1))), binpow(binpow(y * y - 3 * y + 3, n - 1), k));
    cout << res << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t = 1;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3624kb

input:

1
2 3 3

output:

162

result:

ok single line: '162'

Test #2:

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

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
349400141
536959608
52489881
53690844
176686901
218103365
374278717
991895211
693053429
883715672
80402569
0
0
122563013

result:

wrong answer 8th lines differ - expected: '243010659', found: '536959608'