QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#625846 | #9107. Zayin and Count | Tecy | WA | 13ms | 3548kb | C++20 | 1.3kb | 2024-10-09 21:24:10 | 2024-10-09 21:24:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using i128 = __int128_t;
constexpr int N = 10;
void solve() {
vector<int> a(N);
for (auto& x : a) {
cin >> x;
}
vector<int> b(N);
for (auto& x : b) {
cin >> x;
}
vector<char> pos(N);
for (int i = 1; i < N; i++) {
a[i] += a[i - 1];
b[i] += b[i - 1];
if (b[i] != b[i - 1]) {
pos[b[i] - 1] = i + '0';
}
}
if (pos[0] == 0) {
pos[0] = '0';
}
auto eval = [&](string s) -> i128 {
i128 ans = 0;
for (auto& x : s) {
ans = ans * a[N - 1] + (a[x - '0'] - 1);
}
return ans;
};
auto tran = [&](i128 x) -> string {
if (x == 0) {
return string(1, pos[0]);
}
string t;
while (x > 0) {
t += pos[x % b[N - 1]];
x /= b[N - 1];
}
reverse(t.begin(), t.end());
return t;
};
string s;
cin >> s;
cout << tran(eval(s)) << "\n";
}
/*
1
1 0 1 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0
20
*/
int main() {
ios::sync_with_stdio(false);
cout.tie(0);
cin.tie(0);
int T = 1;
cin >> T;
while (T--) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 13ms
memory: 3548kb
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'