QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#504736 | #9107. Zayin and Count | ikun# | WA | 12ms | 3608kb | C++20 | 1.1kb | 2024-08-04 15:28:07 | 2024-08-04 15:28:09 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int unsigned long long
#define all(x) (x).begin(), (x).end()
#define ls id << 1
#define rs id << 1 | 1
using i128 = __int128_t;
void solve(){
int ac = 0, bc = 0;
vector<int>a(10), b(10), av(10), bv(10), at(10), bt(10);
for(int i = 0;i < 10;i++){
cin >> a[i];
if(a[i]){
av[ac] = i;
at[i] = ac++;
}
}
for(int i = 0;i < 10;i++){
cin >> b[i];
if(b[i]){
bv[bc] = i;
bt[i] = bc++;
}
}
string s;
cin >> s;
for(auto &c : s) {
c = at[c-'0'] + '0';
}
vector<i128>pw(s.size());
pw[0] = 1;
for(int i = 1;i < pw.size();i++) pw[i] = pw[i-1] * ac;
int x = 0;
for(int i = 0;i < s.size();i++){
x += pw[s.size()-i-1] * (s[i]-'0');
}
s = "";
while(x){
s.push_back((x % bc) + '0');
x /= bc;
}
reverse(s.begin(), s.end());
for(auto &c : s) {
c = bv[c-'0'] + '0';
}
cout << s << endl;
}
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: 12ms
memory: 3608kb
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'