QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#534170#9229. Juliet Unifies Onesshift#WA 0ms3656kbC++20792b2024-08-26 21:34:312024-08-26 21:34:31

Judging History

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

  • [2024-08-26 21:34:31]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3656kb
  • [2024-08-26 21:34:31]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

void solve() {
    std::string s;
    std::cin >> s;

    int n = s.size();
    int ans = n - std::count(s.begin(), s.end(), '1');
    for(int i = 0; i < n; i ++ ) {
        for(int j = i; j < n; j ++ ) {
            int t = 0;
            for(int x = 0; x < n; x ++ ) {
                if(x >= i and x <= j) {
                    t += s[x] != '1';
                } else {
                    t += s[x] != '0';
                }
            }
            ans = std::min(ans, t);
        }
    }
    std::cout << ans << '\n';
}

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

    int T = 1;
    // std::cin >> T;

    while(T -- ) {
        solve();
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3556kb

input:

00011011001

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

11101111111111111101001011110111111110011101010110

output:

11

result:

ok 1 number(s): "11"

Test #3:

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

input:

00000000100000000000100000010001000

output:

3

result:

ok 1 number(s): "3"

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3624kb

input:

00000000000000000000000000000000000000000000000000

output:

1

result:

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