QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#404715#7606. Digital Nimucup-team3396#WA 1ms3732kbC++141.6kb2024-05-04 15:13:102024-05-04 15:13:12

Judging History

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

  • [2024-05-04 15:13:12]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3732kb
  • [2024-05-04 15:13:10]
  • 提交

answer

#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<ll,ll>
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define per(i,a,b) for(ll i=(a);i>=(b);--i)
using namespace std;
bool Mbe;
ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void write(ll x){
    if(x<0)putchar('-'),x=-x;
    if(x>9)write(x/10);
    putchar(x%10+'0');
}
ll T,n,pw[20];
ll calc(ll x){
    ll res=0;
    while(x)res+=x%10,x/=10;
    return res;
}
ll work(ll n,ll x,ll c);
unordered_map<ll,ll>mp;
ll oni(ll n,ll o,ll p,ll q){
    ll sta=n*200*200*200+o*200*200+p*200+q;
    if(mp.count(sta))return mp[sta];
    ll v=work(n*pw[o]-1,p,q);
    ll res=(v+1>(n+p)/10?0:v+1);
    return mp[sta]=res;
}
ll work(ll n,ll x,ll c){
    if(!n)return c;
    ll lg=0;
    while(pw[lg+1]<=n)lg++;
    ll v=oni(n/pw[lg],lg,x,c);
    return work(n%pw[lg],x+n/pw[lg],v);
}
ll solve(ll debug=0){
    if(debug){
        n=debug;
        if(n%10)return 1;
        else if(work(n/10,0,0))return 1;
        return 0;
    }
    n=read();
    if(n%10)puts("Algosia");
    else {
        if(work(n/10,0,0))puts("Alogsia");
        else puts("Bajtek");
    }
    return 0;
}
bool Med;
int main(){
    // freopen("a.out","w",stdout);
    pw[0]=1;
    rep(i,1,18)pw[i]=pw[i-1]*10;
    cerr<<fabs(&Med-&Mbe)/1048576.0<<"MB\n";
    T=read();
    while(T--)solve();
    // rep(i,1,1000){
    //     if(solve(i*10))cout<<i<<endl;
    // }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3732kb

input:

4
1
10
42
190

output:

Algosia
Bajtek
Algosia
Alogsia

result:

wrong answer 4th lines differ - expected: 'Algosia', found: 'Alogsia'