QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#748528#9107. Zayin and CountOOBMABTRAMS#WA 15ms3600kbC++17802b2024-11-14 20:38:292024-11-14 20:38:35

Judging History

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

  • [2024-11-14 20:38:35]
  • 评测
  • 测评结果:WA
  • 用时:15ms
  • 内存:3600kb
  • [2024-11-14 20:38:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1000013;
const int P=998244353;
int f[10],g[10],to[10],tt;
void solve(){
    for(int i=0;i<=9;i++)cin>>f[i];
    for(int i=0;i<=9;i++)cin>>g[i];
    for(int i=0;i<10;i++)if(f[i])to[i]=tt++;
    string s;
    cin>>s;
    int jz=tt;
    __int128 num=0;
    assert(jz>=2);
    for(auto c:s)num=num*jz+to[c-'0'];
    string t;
    tt=0;
    for(int i=0;i<10;i++)if(g[i])to[tt++]=i;
    jz=tt;
    assert(jz>=2);
    while(num){
        auto v=num%jz;
        num/=jz;
        t+=(char)('0'+to[v]);
    }
    reverse(t.begin(),t.end());
    if(t.empty())t+=(char)('0'+to[0]);
    cout<<t<<'\n';

}
int main(){
    ios::sync_with_stdio(false);
    int T=1;
    cin>>T;
    while(T--)solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 15ms
memory: 3600kb

input:

10000
1 0 0 0 1 1 0 0 0 1
0 0 1 0 1 1 1 1 0 0
950595954440050004054505054050
1 0 0 0 1 1 1 1 0 0
1 1 1 0 1 0 0 0 1 1
45467007076660767550460064
1 1 1 1 0 0 0 1 0 0
1 1 0 1 1 0 1 0 0 1
23373171320213300170200722
0 0 0 0 1 1 1 0 1 0
0 0 1 0 0 1 0 1 1 1
558565664666565565558468668484
1 1 0 0 1 0 1 0 1 ...

output:

65266455722475422254727242
1240108000081019211914919401080218
43110111391016399466136664909149013
8728875825988222285892272929992825527987795
52728258885878827558782522258828572275888525
711610670710717710776670671777610616716670677
858568685885856886658555586655655665665685885855868688558
655166156...

result:

wrong answer 1st lines differ - expected: '52755244567262766742575722', found: '65266455722475422254727242'