QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#504555#9107. Zayin and CountXunwuqishi#WA 19ms3612kbC++231.2kb2024-08-04 13:49:292024-08-04 13:49:29

Judging History

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

  • [2024-08-04 13:49:29]
  • 评测
  • 测评结果:WA
  • 用时:19ms
  • 内存:3612kb
  • [2024-08-04 13:49:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define lowbit(x) x&(-x)
#define int long long

const int N = 1e6+10;
int INF  = 1e9;
//int mod = 1e9+7;
//int mod =  1e9+7;
//int ways[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};

int n,m;
int a[20],b[20];
map<int,int> ma,mb;
string ta;

void solve() {
    ma.clear();
    mb.clear();

    for(int i = 0;i<=9;i++) cin>>a[i];
    int ca = 0;
    for(int i = 0;i<=9;i++){
        if(a[i]) ma[i] = ca++;
    }

    for(int i = 0;i<=9;i++) cin>>b[i];
    int cb = 0;
    for(int i = 0;i<=9;i++){
        if(b[i]) mb[cb++] = i;
    }

    cin>>ta;

    int num = 0;

    for(int i = 0;i<ta.size();i++){
        num = num*ma.size() + ma[ta[i]-'0'];
    }

    string ans = "";

    if(num == 0) ans += mb[0]+'0';

    while(num){
        ans = (char)(mb[num%mb.size()]+'0') + ans;
        num /= mb.size();
    }

    cout<<ans<<endl;
    return;

}
signed main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cout<<fixed<<setprecision(8);
    int caset = 1;
    cin>>caset;

    for(int i = 1;i<=caset;i++){
        //cout<<"Case "<<i<<": "<<endl;
		solve();
	}

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 19ms
memory: 3612kb

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'