QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#117559#6628. Flip it and Stick itbashkort#1 1ms3960kbC++201.1kb2023-07-01 17:32:002024-05-31 18:45:50

Judging History

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

  • [2024-05-31 18:45:50]
  • 评测
  • 测评结果:1
  • 用时:1ms
  • 内存:3960kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-01 17:32:00]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string s, t;
    cin >> s >> t;

    const int n = size(s), m = size(t);

    if (t[0] == '1') {
        char x = '0' ^ '1';
        for (char &c : s) {
            c ^= x;
        }
        for (char &c : t) {
            c ^= x;
        }
    }

    if (m == 1) {
        cout << (s.find(t) == string::npos ? 0 : -1) << '\n';
        return 0;
    }
    
    if (m == 2) {
        if (t[0] != t[1]) {
            int till = find(s.begin(), s.end(), '1') - s.begin();
            if (till == n) {
                cout << 0 << '\n';
            } else {
                int ans = 0;
                for (int i = 0, j = 0; i < till; i = j) {
                    while (j < n && s[i] == s[j]) {
                        j += 1;
                    }
                    ans += s[i] == '0';
                }
                cout << ans << '\n';
            }
        } else {

        }
    }

    return 0;
}

詳細信息

Subtask #1:

score: 1
Accepted

Test #1:

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

input:

1
0

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

1
1

output:

-1

result:

ok 1 number(s): "-1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

-1

result:

ok 1 number(s): "-1"

Test #4:

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

input:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

input:

101001000011101010101001001010010110111111001100110001111101111110110110101011111010001101111001101101010111101100000110001110001100000101111100000110111110001010101101101110001000011010000101000110110010110110100001110001111001010000000010000000101000000100110011101110100111111101111111111110010101...

output:

-1

result:

ok 1 number(s): "-1"

Test #6:

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

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0

result:

ok 1 number(s): "0"

Test #7:

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

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

-1

result:

ok 1 number(s): "-1"

Subtask #2:

score: 0
Wrong Answer

Test #8:

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

input:

0
01

output:

0

result:

ok 1 number(s): "0"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

0
10

output:

0

result:

ok 1 number(s): "0"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

01
01

output:

1

result:

ok 1 number(s): "1"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

01
10

output:

0

result:

ok 1 number(s): "0"

Test #12:

score: -3
Wrong Answer
time: 0ms
memory: 3600kb

input:

1010101010
10

output:

1

result:

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

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #40:

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

input:

11
011

output:


result:

wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements

Subtask #5:

score: 0
Wrong Answer

Test #53:

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

input:

11
011

output:


result:

wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements

Subtask #6:

score: 0
Skipped

Dependency #4:

0%