QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#117691#6628. Flip it and Stick itsomethingnew#1 1ms3804kbC++231.1kb2023-07-01 23:33:402024-05-31 18:47:01

Judging History

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

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

answer

//  ↘ ⬇ ⬇ ⬇ ⬇ ⬇ ↙
//  ➡ @roadfromroi ⬅
//  ↗ ⬆ ⬆ ⬆ ⬆ ⬆ ↖
#include <iostream>
#include "vector"
#include "algorithm"
#include "numeric"
#include "climits"
#include "iomanip"
#include "bitset"
#include "cmath"
#include "map"
#include "deque"
#include "array"
#include "set"
#define all(x) x.begin(), x.end()
using namespace std;
int get0(string s) {
    for (auto i : s) {
        if (i == '0')
            return -1;
    }
    return 0;
}
void solve() {
    string s, t;
    cin >> s >> t;
    int cn = 0;
    for (auto i : t) {
        if (i == '0')
            cn++;
        else
            cn--;
    }
    if (cn < 0) {
        for (auto &i : t) {
            i = '1' - i + '0';
        }
        for (auto &i : s) {
            i = '1' - i + '0';
        }
    }
    if (t[0] != '0') {
        reverse(all(t));
        reverse(all(s));
    }
    if (t == "0") {
        cout << get0(s) << '\n';
    }
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int t = 1;
    while (t--) {
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

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

input:

1
0

output:

0

result:

ok 1 number(s): "0"

Test #2:

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

input:

1
1

output:

-1

result:

ok 1 number(s): "-1"

Test #3:

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

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

-1

result:

ok 1 number(s): "-1"

Test #4:

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

input:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

input:

101001000011101010101001001010010110111111001100110001111101111110110110101011111010001101111001101101010111101100000110001110001100000101111100000110111110001010101101101110001000011010000101000110110010110110100001110001111001010000000010000000101000000100110011101110100111111101111111111110010101...

output:

-1

result:

ok 1 number(s): "-1"

Test #6:

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

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0

result:

ok 1 number(s): "0"

Test #7:

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

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

-1

result:

ok 1 number(s): "-1"

Subtask #2:

score: 0
Wrong Answer

Test #8:

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

input:

0
01

output:


result:

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

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #40:

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

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: 3604kb

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%