QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#504733 | #9107. Zayin and Count | learner__# | WA | 0ms | 3544kb | C++20 | 1.5kb | 2024-08-04 15:27:05 | 2024-08-04 15:27:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5 + 10;
int a[10], mpa[10], mpa2[10], tota;
int b[10], mpb[10], mpb2[10], totb;
void solve()
{
tota = -1;
totb = -1;
for(int i = 0; i < 10; i++)
{
cin >> a[i];
if(a[i])
{
mpa[++tota] = i;
mpa2[i] = tota;
}
}
for(int i = 0; i < 10; i++)
{
cin >> b[i];
if(b[i])
{
mpb[++totb] = i;
mpb2[i] = totb;
}
}
int x;
cin >> x;
int tmp = x;
for(int p = 1; tmp; p *= 10, tmp /= 10)
{
x -= tmp % 10 * p;
x += mpa2[tmp % 10] * p;
}
// cerr << x << '\n';//10
int base = tota + 1;
//x(jz)
int rk = 0;
for(int p = 1; x; p *= base, x /= 10)
{
rk += x % 10 * p;
}
if(rk == 0)
{
cout << mpb[0] << '\n';
return;
}
// cerr << rk << '\n';//2
string res = "";
base = totb + 1;
for(; rk; rk /= base)
{
res += rk % base + '0';
// cerr << "???? " << '\n';
}
// cerr << res << '\n';//10
string ans = "";
for(; res != "";)
{
int t = res.back() - '0';
res.pop_back();
ans += mpb[t] + '0';
}
cout << ans << '\n';
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int t = 1;
cin >> t;
while(t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3544kb
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:
44667526264755622 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
result:
wrong answer 1st lines differ - expected: '52755244567262766742575722', found: '44667526264755622'