QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#624377 | #9107. Zayin and Count | expectant# | WA | 11ms | 5588kb | C++14 | 1.1kb | 2024-10-09 15:42:26 | 2024-10-09 15:42:26 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=j;i<=(k);++i)
#define drp(i,j,k) for(int i=j;i>=(k);--i)
#define MAXN 1000005
typedef long long ll;
typedef __int128 i128;
inline int read(){
int x=0;
bool sgn=true;
char ch=getchar();
while(!isdigit(ch)) sgn^=ch=='-',ch=getchar();
while(isdigit(ch)) x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
return sgn?x:-x;
}
inline void chkmin(int &x,int y){x=std::min(x,y);}
int a[MAXN],b[MAXN];
std::string s;
std::vector<int> v1,v2;
inline void init(){
std::vector<int>().swap(v1);
std::vector<int>().swap(v2);
}
inline void solve(){
i128 cur=1,x=0;
std::string ans;
rep(i,0,(int)s.length()-1){
int pos=std::lower_bound(v1.begin(),v1.end(),s[i]-'0')-v1.begin();
x+=pos*cur,cur*=v1.size();
}
while(x){
int cur=x%v2.size();
ans+=v2[cur]+'0',x/=v2.size();
}
std::reverse(ans.begin(),ans.end());
std::cout<<ans<<'\n';
}
int main(){
drp(task,read(),1){
init();
rep(i,0,9) a[i]=read();
rep(i,0,9) b[i]=read();
std::cin>>s,std::reverse(s.begin(),s.end());
rep(i,0,9) if(a[i]) v1.push_back(i);
rep(i,0,9) if(b[i]) v2.push_back(i);
solve();
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 11ms
memory: 5588kb
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'