QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#398428 | #3763. Absolute Difference Equation | Hjcc# | WA | 90ms | 4572kb | C++14 | 934b | 2024-04-25 12:02:10 | 2024-04-25 12:02:12 |
Judging History
answer
# include <bits/stdc++.h>
# define ll long long
using namespace std;
const int N = 1e6 + 5;
char s[N];
ll ans = 1, cnt = 0;
const ll mod = 1e9 + 7;
bool ck(int i, int n) {
int x = n - 1;
while (x) {
if (x % 4 < i % 4) {
return 0;
}
x >>= 2, i >>= 2;
}
return 1;
}
int main() {
# ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
# endif
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
while (cin >> s) {
int n = strlen(s);
bool fl = 0, now = 0; cnt = 0; ans = 1;
for (int i = 0; i < n; i++) {
if (s[i] == '?') {
++cnt;
fl |= (ck(i, n));
} else {
if (ck(i, n)) {
now ^= (s[i] == '1');
}
}
}
if (cnt == 0 && now == 0) {
cout << 0 << '\n';
continue;
}
cnt -= fl;
while (cnt--) {
ans = ans * 2 % mod;
}
cout << ans << '\n';
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 90ms
memory: 4572kb
input:
1 ????? 1010?1?0 0 1 ? 00 10 ?0 01 11 ?1 0? 1? ?? 000 100 ?00 010 110 ?10 0?0 1?0 ??0 001 101 ?01 011 111 ?11 0?1 1?1 ??1 00? 10? ?0? 01? 11? ?1? 0?? 1?? ??? 0000 1000 ?000 0100 1100 ?100 0?00 1?00 ??00 0010 1010 ?010 0110 1110 ?110 0?10 1?10 ??10 00?0 10?0 ?0?0 01?0 11?0 ?1?0 0??0 1??0 ???0 0001 10...
output:
1 16 2 0 1 1 0 1 1 1 0 1 1 1 2 0 1 1 1 0 1 1 1 2 1 0 1 0 1 1 1 1 2 1 1 2 1 1 2 2 2 4 0 1 1 1 0 1 1 1 2 1 0 1 0 1 1 1 1 2 1 1 2 1 1 2 2 2 4 1 0 1 0 1 1 1 1 2 0 1 1 1 0 1 1 1 2 1 1 2 1 1 2 2 2 4 1 1 2 1 1 2 2 2 4 1 1 2 1 1 2 2 2 4 2 2 4 2 2 4 4 4 8 0 1 1 0 1 1 2 2 2 0 1 1 0 1 1 2 2 2 2 2 2 2 2 2 4 4 4...
result:
wrong answer 19th lines differ - expected: '0', found: '1'