QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#504783#9107. Zayin and Countblhxzjr#WA 6ms3560kbC++203.0kb2024-08-04 15:56:302024-08-04 15:56:31

Judging History

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

  • [2024-08-04 15:56:31]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:3560kb
  • [2024-08-04 15:56:30]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i, a, n) for (int i = a; i <= n; i++)
#define pb push_back
#define fi first
#define se second
#define sz(x) x.size()
#define lowbit(x) (x & (-x))
#define all(x) x.begin(), x.end()
#define inf 0x3f3f3f3f3f3f3f3f
#define int long long
using ll = long long;
using PII = pair<int, int>;
constexpr int N = 1e5 + 10;

using LD = long double;
mt19937_64 rnd(chrono::duration_cast<chrono::nanoseconds>(chrono::system_clock::now().time_since_epoch()).count());

int n,m,k,_;
// const int M=N*70;
// int t[M],ls[M],rs[M];
// int tot,root;

// inline void up(int id){
// 	t[id]=t[ls[id]]+t[rs[id]];
// }
// void modify(int &id,int l,int r,int x,int v){
// 	if(!id) id=++tot;
// 	if(l==r){
// 		t[id]+=v; return;
// 	}
// 	int mid=l+r>>1;
// 	if(x<=mid) modify(ls[id],l,mid,x,v);
// 	else modify(rs[id],mid+1,r,x,v);
// 	up(id);
// }
// int query(int id,int l,int r,int ql,int qr){
// 	if(ql<=l&&r<=qr){
// 		return t[id];
// 	}
// 	int mid=l+r>>1;
// 	if(qr<=mid) return query(ls[id],l,mid,ql,qr);
// 	else if(ql>mid) return query(rs[id],mid+1,r,ql,qr);
// 	else return query(ls[id],l,mid,ql,qr)+query(rs[id],mid+1,r,ql,qr);
// }
// void solve(){
// 	cin>>n>>m;
// 	int op,l,r,v;
// 	rep(i,1,m){
// 		cin>>op>>l;
// 		if(op==1){
// 			cin>>v;
// 			for(int j=l;j<=n;j+=lowbit(j)){
// 				modify(root,1,n,j,v);
// 			}
// 		}
// 		else{
// 			cin>>r;
// 			cout<<query(root,1,n,l,r)<<endl;
// 		}
// 	}
// }
int a[100],b[100];
void solve(){
	vector<int>aa,bb;
	map<int,int>ap,bp;
	rep(i,0,9){
		cin>>a[i];
		if(a[i]==1){
			aa.pb(i);
			ap[i]=aa.size()-1;
		}
	}
	rep(i,0,9){
		cin>>b[i];
		if(b[i]==1){
			bb.pb(i);
			bp[i]=bb.size()-1;
		}
	}
	cin>>n;
	if(bb.size()==1||aa.size()==1){
		if(aa.size()==1&&bb.size()!=1){
			int ans=0;
			while(n){
				ans++;
				n/=10;
			}
			int q=bb.size();
			vector<int>res;
			while(ans){
				res.pb(ans%q);
				ans/=q;
			}
			reverse(all(res));
			for(auto i:res){
				cout<<bb[i];
			}
			return;
		}
		else if(bb.size()==1&&aa.size()!=1){
			vector<int>t;
			while(n){
				t.pb(ap[n%10]);
				n/=10;
			}
			int id=1,ans=0,p=aa.size(),q=bb.size();
				for(auto i:t){
				ans+=i*id;
				id*=p;
			}
			ans++;
			rep(i,1,ans) cout<<bb[0]; 
			return;
		}
		else{
			int ans=0;
			while(n){
				ans++;
				n/=10;
			}
			vector<int>res;
			while(ans){
				ans--;
				res.pb(0);
			}
			for(auto i:res){
				cout<<bb[i];
			}
			return;
		}
	}
	vector<int>t;
	while(n){
		t.pb(ap[n%10]);
		n/=10;
	}
	int id=1,ans=0,p=aa.size(),q=bb.size();
	for(auto i:t){
		ans+=i*id;
		id*=p;
	}
	vector<int>res;
	while(ans){
		res.pb(ans%q);
		ans/=q;
	}
	reverse(all(res));
	for(auto i:res){
		cout<<bb[i];
	}
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    _ = 1;
    cin >> _;
    while (_--)
    {
        solve();
        if (_)
            cout << endl;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 6ms
memory: 3560kb

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:

44667526264755622


























































































































































































































































































...

result:

wrong answer 1st lines differ - expected: '52755244567262766742575722', found: '44667526264755622'