QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#562208#9229. Juliet Unifies Onestien_noobWA 0ms3620kbC++141.1kb2024-09-13 15:44:582024-09-13 15:44:58

Judging History

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

  • [2024-09-13 15:44:58]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3620kb
  • [2024-09-13 15:44:58]
  • 提交

answer

//Make CSP great again
//Vengeance
#include <bits/stdc++.h>
#define TASK "TESTCODE"
using namespace std;
const int N = 2e5;
int n, k, m;
int a[N + 1];
void read()
{
    cin >> n >> k >> m;
    for (int i = 1; i <= n; ++ i)
    {
        cin >> a[i];
        a[i] -= m;
    }
}
void solve()
{
    string s;
    cin >> s;
    int n = s.size();
    int pf = 0;
    int res = n;
    for (int x = 0; x < n; x++) {
        for (int y = x; y < n; y++) {
            int cur = pf;
            for (int i = y + 1; i < n; i++) cur += s[i] == '1';
            for (int i = x; i <= y; i++) cur += s[i] == '0';
            res = min(res, cur);
        }
        pf += s[x] == '1';
    }
    cout << res << "\n";
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    if (fopen(TASK".INP", "r"))
    {
        freopen(TASK".INP", "r", stdin);
    }
    int t = 1;
    bool typetest = false;
    if (typetest)
    {
        cin >> t;
    }
    for (int __ = 1; __ <= t; ++ __)
    {
        //cout << "Case " << __ << ": ";
//        read();
        solve();
    }
}

詳細信息

Test #1:

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

input:

00011011001

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

11101111111111111101001011110111111110011101010110

output:

11

result:

ok 1 number(s): "11"

Test #3:

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

input:

00000000100000000000100000010001000

output:

3

result:

ok 1 number(s): "3"

Test #4:

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

input:

00000000000000000000000000000000000000000000000000

output:

1

result:

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