QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#874508#8619. Interactive CasinoCoffins#TL 0ms0kbC++173.1kb2025-01-28 09:43:462025-01-28 09:43:46

Judging History

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

  • [2025-01-28 09:43:46]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2025-01-28 09:43:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define beg begin
#define All(A) A.beg(),A.end()
#define pb push_back
#define fst first
#define sec second
#define gr greater<>()
#define Lsh(A) sort(All(A)),\
A.erase(unique(All(A)),A.end());
#define u_set unordered_set
#define u_map unordered_map
#define lwb lower_bound
#define upb upper_bound
using ull=unsigned long long;
using ll=long long;
using ld=long double;
using pii=pair<int,int>;
using vi=vector<int>;
using gi=greater<int>;
using str=string;
using bqi=priority_queue<int>;
using lqi=priority_queue<int,vi,gi>;
using qi=queue<int>;
using si=set<int>;
using usi=u_set<int>;
using vll=vector<ll>;
using pll=pair<ll,ll>;
using vvi=vector<vi>;
using vvl=vector<vll>;
using vpi=vector<pii>;
using ply=vll;
const int p=998244353;
const int i2=(p+1)/2;
ll ksm(ll a,ll b)
{
    ll ans=1;while(b)
    {
        if(b&1)ans=ans*a%p;
        a=a*a%p;b>>=1;
    }return ans;
}const int Msz=1e6+5;
ll fc[Msz],iv[Msz];
void init_C(int n)
{
    fc[0]=1;for(int i=1;i<=n;i++)fc[i]=fc[i-1]*i%p;
    iv[n]=ksm(fc[n],p-2);for(int i=n-1;i>=0;i--)
    iv[i]=iv[i+1]*(i+1)%p;
}ll C(int n,int m)
{
    if(n<m||m<0)return 0;
    return fc[n]*iv[m]%p*iv[n-m]%p;
}
namespace Poly
{
    const int N=1<<21;int rv[N];
    const int g=3,ig=(p+1)/g;
    void init(int n)
    {
        for(int i=1;i<=n;i++)
        {
            rv[i]=rv[i>>1]>>1;
            if(i&1)rv[i]|=(n>>1);
        }
    }
    void NTT(ll *a,int l,int o)
    {
        for(int i=0;i<l;i++)
        if(i<rv[i])swap(a[i],a[rv[i]]);
        for(int d=1;d<l;d<<=1)
        {
            ll pw=ksm(g,(p-1)/d/2);
            if(o<0)pw=ksm(pw,p-2);
            for(int i=0;i<l;i+=(d<<1))
            {
                ll vl=1;
                for(int j=i;j<i+d;j++)
                {
                    ll x=a[j],y=a[j+d]*vl%p;
                    if((a[j]=x+y)>=p)a[j]-=p;
                    if((a[j+d]=x-y)<0)a[j+d]+=p;
                    vl=vl*pw%p;
                }
            }
        }if(o<0)
        {
            ll vl=ksm(l,p-2);
            for(int i=0;i<l;i++)
            a[i]=a[i]*vl%p;
        }
    }
    ply mul(ply f,ply g)
    {
        int n=f.size()-1,m=g.size()-1;
        ply rs(n+m+1);int l=1;
        while(l<=n+m)l<<=1;
        static ll a[N],b[N];init(l);
        for(int i=0;i<l;i++)a[i]=b[i]=0;
        for(int i=0;i<=n;i++)a[i]=f[i];
        for(int i=0;i<=m;i++)b[i]=g[i];
        NTT(a,l,1),NTT(b,l,1);
        for(int i=0;i<l;i++)a[i]=a[i]*b[i]%p;
        NTT(a,l,-1);for(int i=0;i<=n+m;i++)
        rs[i]=a[i];return rs;
    }
}using Poly::mul;
const ld c=0.4;
void solve()
{
    int t;cin>>t;
    for(int i=1;i<=t;i++)
    {
        string s;cin>>s;
        if(s=="WIN")return;
        if(s=="LOSE")return;
        int m,b;cin>>m>>b;
        if(b<=c*m)cout<<"PLAY\n";
        else cout<<"SKIP\n";
    }
}void init(){init_C(Msz-5);}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int t=1;init();//cin>>t;
    while(t--)solve();
    return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Time Limit Exceeded

input:

5
ROUND 1000 43

output:


result: