QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#748542 | #9107. Zayin and Count | OOBMABTRAMS# | WA | 21ms | 3592kb | C++17 | 883b | 2024-11-14 20:39:52 | 2024-11-14 20:39:52 |
Judging History
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(){
tt=0;
for(int i=0;i<10;i++)to[i]=0;
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++)to[i]=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: 21ms
memory: 3592kb
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'