QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#504688#9107. Zayin and CountLavender_Field#WA 6ms3876kbC++201.5kb2024-08-04 14:50:172024-08-04 14:50:17

Judging History

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

  • [2024-08-04 14:50:17]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:3876kb
  • [2024-08-04 14:50:17]
  • 提交

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;
}
ll rdl() {
	ll 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 100
char s[MAXL];
int avis[MAXL], bvis[MAXL];
int bnum[MAXL], bcnt, acnt;
int st[MAXL];
inline int quick_pow( int a , int p , int mod ) {
	int ret = 1;
	for(;p;p>>=1) {
		if( p & 1 ) ret = 1ll * ret * a % mod;
		a = 1ll * a * a % mod;
	}
	return ret;
}
void solve() {
	acnt = 0; FOR(i,0,9) avis[i] = rd(), acnt += avis[i];
	bcnt = 0;
	FOR(i,0,9) {
		bvis[i] = rd();
		if( bvis[i] ) bnum[++bcnt] = i;
	}
	
	FOR(i,1,9) avis[i] += avis[i-1];
	scanf("%s", s+1);
	int l = strlen(s+1);
	__int128 mul = 1;
	__int128 x = 0;
	ROF(i,l,1) 
		x += mul * (avis[s[i] - '0'] - 1), mul *= acnt;

	st[0] = 0;
	if( x == 0 ) st[st[0] = 1] = 0;
	while( x ) st[++st[0]] = x%bcnt, x/=bcnt;
	ROF(i,st[0],1) putchar('0' + bnum[st[i] + 1]); 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: 6ms
memory: 3876kb

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'