이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int l, q; cin >> l >> q;
string tox; cin >> tox;
while (q--){
string s; cin >> s;
int ans = 0;
for (int mask = 0; mask < (1 << l); mask++){
bool add = true;
for (int i = l-1; i >= 0; i--){
if (s[i] != '?' && (s[i]-'0') != (bool)((mask >> (l-i-1)) & 1)){
add = false;
break;
}
}
if (add)
ans += tox[mask]-'0';
}
cout << ans << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |