QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#562208 | #9229. Juliet Unifies Ones | tien_noob | WA | 0ms | 3620kb | C++14 | 1.1kb | 2024-09-13 15:44:58 | 2024-09-13 15:44:58 |
Judging History
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'