QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#708193#8833. Equalizer Ehrmantrautucup-team134#AC ✓146ms3948kbC++141.8kb2024-11-03 20:10:342024-11-03 20:10:41

Judging History

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

  • [2024-11-03 20:10:41]
  • 评测
  • 测评结果:AC
  • 用时:146ms
  • 内存:3948kb
  • [2024-11-03 20:10:34]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int a[100],b[100];
void Brute(int pos,int n,int m){
    if(pos==n){
        bool ok=true;
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                ok&=(min(a[i],b[j])==min(a[j],b[i]));
            }
        }
        if(ok){
            printf("\n");
            for(int i=0;i<n;i++)printf("%i ",a[i]);printf("\n");
            for(int i=0;i<n;i++)printf("%i ",b[i]);printf("\n");
        }
        return;
    }
    for(int i=1;i<=m;i++){
        for(int j=1;j<=m;j++){
            a[pos]=i;
            b[pos]=j;
            Brute(pos+1,n,m);
        }
    }
}

#define ll long long
const int mod=998244353;
int add(int x,int y){x+=y;return x>=mod?x-mod:x;}
int sub(int x,int y){x-=y;return x<0?x+mod:x;}
int mul(int x,int y){return (ll)x*y%mod;}
int powmod(int x,int k){
    int ans=1;
    for(;k;k>>=1,x=mul(x,x))if(k&1)ans=mul(ans,x);
    return ans;
}

const int N=1000050;
int F[N],I[N];
int binom(int n,int k){
    return mul(F[n],mul(I[k],I[n-k]));
}

int main(){
    int n,m;
    scanf("%i %i",&n,&m);
    //Brute(0,n,m);
    /*F[0]=1;
    for(int i=1;i<=m;i++)F[i]=mul(F[i-1],i);
    I[0]=I[1]=1;
    for(int i=2;i<=m;i++)I[i]=mul(mod-mod/i,I[mod%i]);
    for(int i=1;i<=m;i++)I[i]=mul(I[i],I[i-1]);*/

    int same=powmod(m,n);
    int diff=0;
    for(int mx=1;mx<m;mx++){
        int hi=m-mx;
        int lo=mx;
        int now=sub(powmod(lo+hi,n),powmod(lo,n));
        diff=add(diff,now);
    }
    int ans=add(mul(diff,2),same);
    printf("%i\n",ans);

    /*int dp1=1,dp2=1;
    int m2=((ll)m*(m+1)/2)%mod;
    for(int i=1;i<=n;i++){
        dp1=mul(dp1,m);
        dp2=mul(dp2,m2);
    }
    int ans=sub(mul(dp2,2),dp1);
    printf("%i\n",ans);*/
    return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

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

input:

1 3

output:

9

result:

ok 1 number(s): "9"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

2 2

output:

10

result:

ok 1 number(s): "10"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

69 42

output:

608932821

result:

ok 1 number(s): "608932821"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3940kb

input:

102 156

output:

748401290

result:

ok 1 number(s): "748401290"

Test #5:

score: 0
Accepted
time: 7ms
memory: 3756kb

input:

4646 95641

output:

89806680

result:

ok 1 number(s): "89806680"

Test #6:

score: 0
Accepted
time: 23ms
memory: 3756kb

input:

42849 215151

output:

242217237

result:

ok 1 number(s): "242217237"

Test #7:

score: 0
Accepted
time: 115ms
memory: 3880kb

input:

786416 794116

output:

472898000

result:

ok 1 number(s): "472898000"

Test #8:

score: 0
Accepted
time: 115ms
memory: 3884kb

input:

963852 789456

output:

353211048

result:

ok 1 number(s): "353211048"

Test #9:

score: 0
Accepted
time: 61ms
memory: 3816kb

input:

696969 424242

output:

787990158

result:

ok 1 number(s): "787990158"

Test #10:

score: 0
Accepted
time: 19ms
memory: 3936kb

input:

1000000 123456

output:

533491028

result:

ok 1 number(s): "533491028"

Test #11:

score: 0
Accepted
time: 146ms
memory: 3812kb

input:

1000000 1000000

output:

572586375

result:

ok 1 number(s): "572586375"

Test #12:

score: 0
Accepted
time: 112ms
memory: 3884kb

input:

123456 1000000

output:

486967129

result:

ok 1 number(s): "486967129"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

789456 1

output:

1

result:

ok 1 number(s): "1"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3940kb

input:

852516 2

output:

148946358

result:

ok 1 number(s): "148946358"

Test #15:

score: 0
Accepted
time: 2ms
memory: 3840kb

input:

1 953646

output:

40087733

result:

ok 1 number(s): "40087733"

Test #16:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

3 7686

output:

278212472

result:

ok 1 number(s): "278212472"

Extra Test:

score: 0
Extra Test Passed