QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#118018#6628. Flip it and Stick itpandapythoner#4 2ms4460kbC++201.3kb2023-07-02 21:53:212024-05-31 18:47:41

Judging History

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

  • [2024-05-31 18:47:41]
  • 评测
  • 测评结果:4
  • 用时:2ms
  • 内存:4460kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-02 21:53:21]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define flt double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

mt19937 rnd(234);
const ll inf = 1e18;

int n, m;
vector<int> s, t;

ll solve() {
    if (t[0] == 1) {
        for (int i = 0; i < n; i += 1) {
            s[i] ^= 1;
        }
        for (int i = 0; i < m; i += 1) {
            t[i] ^= 1;
        }
    }
    if (m == 1) {
        for (int i = 0; i < n; i += 1) {
            if (s[i] == 0) {
                return -1;
            }
        }
        return 0;
    }
    if (m == 2) {
        if (t[0] != t[1]) {
            int count = 0;
            for (int i = 0; i + 1 < n; i += 1) {
                if (s[i] == 0 && s[i + 1] == 1) {
                    count += 1;
                }
            }
            return count;
        } else {
        }
    }
    return -1;
}

int32_t main() {
    if (1) {
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    }
    string ss, ts;
    cin >> ss >> ts;
    n = ss.size();
    m = ts.size();
    s.resize(n);
    for (int i = 0; i < n; i += 1) {
        s[i] = (ss[i] - '0');
    }
    t.resize(m);
    for (int i = 0; i < m; i += 1) {
        t[i] = (ts[i] - '0');
    }
    cout << solve() << "\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 1ms
memory: 3528kb

input:

1
0

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: 1
Accepted
time: 0ms
memory: 3612kb

input:

1
1

output:

-1

result:

ok 1 number(s): "-1"

Test #3:

score: 1
Accepted
time: 1ms
memory: 4360kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

-1

result:

ok 1 number(s): "-1"

Test #4:

score: 1
Accepted
time: 1ms
memory: 4384kb

input:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

0

result:

ok 1 number(s): "0"

Test #5:

score: 1
Accepted
time: 1ms
memory: 4380kb

input:

101001000011101010101001001010010110111111001100110001111101111110110110101011111010001101111001101101010111101100000110001110001100000101111100000110111110001010101101101110001000011010000101000110110010110110100001110001111001010000000010000000101000000100110011101110100111111101111111111110010101...

output:

-1

result:

ok 1 number(s): "-1"

Test #6:

score: 1
Accepted
time: 2ms
memory: 4308kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0

result:

ok 1 number(s): "0"

Test #7:

score: 1
Accepted
time: 0ms
memory: 4460kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

-1

result:

ok 1 number(s): "-1"

Subtask #2:

score: 3
Accepted

Test #8:

score: 3
Accepted
time: 0ms
memory: 3840kb

input:

0
01

output:

0

result:

ok 1 number(s): "0"

Test #9:

score: 3
Accepted
time: 1ms
memory: 3612kb

input:

0
10

output:

0

result:

ok 1 number(s): "0"

Test #10:

score: 3
Accepted
time: 0ms
memory: 3576kb

input:

01
01

output:

1

result:

ok 1 number(s): "1"

Test #11:

score: 3
Accepted
time: 0ms
memory: 3640kb

input:

01
10

output:

0

result:

ok 1 number(s): "0"

Test #12:

score: 3
Accepted
time: 0ms
memory: 3588kb

input:

1010101010
10

output:

5

result:

ok 1 number(s): "5"

Test #13:

score: 3
Accepted
time: 0ms
memory: 4352kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0

result:

ok 1 number(s): "0"

Test #14:

score: 3
Accepted
time: 1ms
memory: 4372kb

input:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0

result:

ok 1 number(s): "0"

Test #15:

score: 3
Accepted
time: 1ms
memory: 4348kb

input:

010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...

output:

100000

result:

ok 1 number(s): "100000"

Test #16:

score: 3
Accepted
time: 0ms
memory: 4300kb

input:

000110111001011000010001010010010000010100100000011101010000001000110011100000011011100101110110000001000000000011001010001101001110011111001101110010001100000000010000000100100011000111010011100110011101100011000100011001010000010001001010010101100000100000010010110000000001011100100001000010100100...

output:

43860

result:

ok 1 number(s): "43860"

Test #17:

score: 3
Accepted
time: 2ms
memory: 4332kb

input:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

44072

result:

ok 1 number(s): "44072"

Subtask #3:

score: 0
Wrong Answer

Dependency #2:

100%
Accepted

Test #18:

score: 4
Accepted
time: 1ms
memory: 3588kb

input:

0
01

output:

0

result:

ok 1 number(s): "0"

Test #19:

score: 4
Accepted
time: 0ms
memory: 3640kb

input:

0
10

output:

0

result:

ok 1 number(s): "0"

Test #20:

score: 4
Accepted
time: 0ms
memory: 3572kb

input:

01
01

output:

1

result:

ok 1 number(s): "1"

Test #21:

score: 4
Accepted
time: 1ms
memory: 3808kb

input:

01
10

output:

0

result:

ok 1 number(s): "0"

Test #22:

score: 0
Wrong Answer
time: 1ms
memory: 3524kb

input:

1
00

output:

-1

result:

wrong answer 1st numbers differ - expected: '0', found: '-1'

Subtask #4:

score: 0
Wrong Answer

Test #40:

score: 0
Wrong Answer
time: 0ms
memory: 3580kb

input:

11
011

output:

-1

result:

wrong answer 1st numbers differ - expected: '0', found: '-1'

Subtask #5:

score: 0
Wrong Answer

Test #53:

score: 0
Wrong Answer
time: 0ms
memory: 3676kb

input:

11
011

output:

-1

result:

wrong answer 1st numbers differ - expected: '0', found: '-1'

Subtask #6:

score: 0
Skipped

Dependency #4:

0%