QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#504489#9107. Zayin and CountWorldFinalEscaped#WA 10ms3928kbC++141.2kb2024-08-04 13:27:432024-08-04 13:27:45

Judging History

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

  • [2024-08-04 13:27:45]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:3928kb
  • [2024-08-04 13:27:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef __int128 Big;
int T,x,pos1[11],pos2[11],ans[10005]; char s[1005];
vector<int> a,b;
int main(){
    for (cin>>T; T; T--){
        a.clear(),b.clear();
        for (int i=0; i<10; i++) pos1[i]=pos2[i]=0;
        for (int i=0; i<10; i++){
            scanf("%d",&x);
            if (x) a.push_back(i),pos1[i]=a.size()-1;
        }
        for (int i=0; i<10; i++){
            scanf("%d",&x);
            if (x) b.push_back(i),pos2[i]=b.size()-1;
        }
        scanf("%s",s+1); int n=strlen(s+1);
        Big pw=1,cnt=0;
//        printf("==>%d %d\n",a.size(),b.size());
        for (int i=n; i>=1; i--){
            cnt+=pw*pos1[s[i]-'0'];
            pw*=a.size();
//            printf("%d %d %d\n",(int)pw,(int)cnt,pos1[s[i]-'0']);
        }
//        printf("%d\n",(int)cnt);
        if (!cnt){
            printf("%d\n",b[0]);
            continue;
        }
        int len=0;
        while (cnt) ans[++len]=b[cnt%b.size()],cnt/=b.size();
        reverse(ans+1,ans+1+len);
        for (int i=1; i<=len; i++) putchar(ans[i]+'0');puts("");
    }
}
/*
2
1 0 1 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0
20
1 1 0 0 0 0 0 0 0 0
0 0 0 0 1 1 1 0 0 0 
0
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 10ms
memory: 3928kb

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
41990991999414091249949
101364364636933104003903
57259252998225997772927975
878555885282288227752558252252
610010606760761011770006661017
68888858668556558688868865568855558868
51566165566155616511615666156611165656
505885888775005550558080707878
3333916221911699323366319
...

result:

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