QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#613810#9435. Welcome to NPCAPCucup-team5071#WA 0ms3524kbC++20960b2024-10-05 14:47:472024-10-05 14:47:49

Judging History

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

  • [2024-10-05 14:47:49]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3524kb
  • [2024-10-05 14:47:47]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod=998244353;
int ksm(int x,int k){
    int res=1;
    while(k){
        if(k&1)res=res*x%mod;
        x=x*x%mod;
        k/=2;
    }
    return res;
}
int ny(int x){
    return ksm(x,mod-2);
}
void add(int &x,int y){
    if((x+=y)>=mod)x-=mod;
}
void del(int &x,int y){
    if((x-=y)<0)x+=mod;
}
struct info{
    int a,b,t;
};
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;cin>>n;
    vector<info> a(n);
    for(int i=0;i<n;i++)cin>>a[i].t>>a[i].a>>a[i].b;
    sort(a.begin(),a.end(),[&](info a1,info a2){
        return a2.b*(a1.a*a2.t+a1.t)<a1.b*(a2.a*a1.t+a2.t);
    });
    // reverse(a.begin(),a.end());
    int Q=0;
    for(int i=0;i<n;i++){
        int t=a[i].t,p=a[i].a*ny(a[i].b)%mod;
        Q=(t+Q-p*Q%mod+mod)%mod*ny(p)%mod;
        cout<<"t="<<t<<" p="<<p<<" Q="<<Q<<endl;
    }
    cout<<Q;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3524kb

input:

4
12
6
5839
123456

output:

t=12 p=872245708 Q=11678
t=123456 p=0 Q=0
t=0 p=0 Q=0
t=0 p=0 Q=0
0

result:

wrong output format Expected integer, but "t=12" found