QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#504758 | #9107. Zayin and Count | Lavender_Field# | WA | 7ms | 3860kb | C++20 | 1.2kb | 2024-08-04 15:41:07 | 2024-08-04 15:41:07 |
Judging History
answer
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define fi first
#define se second
#define pb push_back
#define Mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int rd() {
int r = 0; bool w = false; char ch = getchar();
while( ch < '0' || ch > '9' ) w = !(ch^45), ch = getchar();
while( ch >= '0' && ch <= '9' ) r = (r<<1) + (r<<3) + (ch^48), ch = getchar();
return w ? -r : r;
}
#define MAXL 64
int avis[10], bvis[10];
int acnt, bcnt, bnum[10];
char s[MAXL+5];
int st[MAXL+5];
void solve() {
acnt = bcnt = 0;
FOR(i,0,9) avis[i] = rd(); FOR(i,0,9) bvis[i] = rd();
FOR(i,0,9) if( avis[i] == 1 ) ++acnt;
FOR(i,0,9) if( bvis[i] == 1 ) bnum[bcnt++] = i;
FOR(i,1,9) avis[i] += avis[i-1];
scanf("%s",s+1);
__int128 x = 0; int len = strlen(s+1);
FOR(i,1,len) {
x = x * acnt + avis[s[i]-'0'] - 1;
}
if( !x ) st[st[0] = 1] = 0;
else st[0] = 0;
while( x ) {
st[++st[0]] = x % bcnt, x /= bcnt;
}
ROF(i,st[0],1) putchar('0' + bnum[st[i]]); putchar('\n');
return;
}
int main() {
int T = rd(); while( T-- ) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 7ms
memory: 3860kb
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'