QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#504714#9107. Zayin and Countlearner__#WA 2ms3624kbC++201.5kb2024-08-04 15:16:312024-08-04 15:16:32

Judging History

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

  • [2024-08-04 15:16:32]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3624kb
  • [2024-08-04 15:16:31]
  • 提交

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

    int res = 0;
    base = totb + 1;
    for(int p = 1; rk; p *= 10, rk /= base)
    {
        res += rk % base * p;
        // cerr << "???? " << '\n';
    }

    // cerr << res << '\n';//10

    int ans = 0;
    for(int p = 1; res; p *= 10, res /= 10)
    {
        ans += mpb[res % 10] * p;
    }

    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: 2ms
memory: 3624kb

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'