QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#398425#3763. Absolute Difference EquationHjcc#WA 60ms4636kbC++14804b2024-04-25 11:59:182024-04-25 11:59:18

Judging History

This is the latest submission verdict.

  • [2024-04-25 11:59:18]
  • Judged
  • Verdict: WA
  • Time: 60ms
  • Memory: 4636kb
  • [2024-04-25 11:59:18]
  • Submitted

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;

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 |= ((i | n - 1) == n - 1);
      } else {
        if ((i | n - 1) == n - 1) {
          now ^= (s[i] == '1');
        }
      }
    }
    if (cnt == 0 && now == 0) {
      cout << 0 << '\n';
      continue;
    }
    cnt -= fl;
    while (cnt--) {
      ans = ans * 2 % mod;
    }
    cout << ans << '\n';
  }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 60ms
memory: 4636kb

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
0
1
1
2
2
2
1
0
1
1
0
1
2
2
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 22nd lines differ - expected: '0', found: '2'