QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#697616 | #9229. Juliet Unifies Ones | ucup-team3160# | WA | 0ms | 3868kb | C++14 | 902b | 2024-11-01 15:07:32 | 2024-11-01 15:07:36 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i <= (b); i ++)
#define nrep(i, a, b) for(int i = (a); i >= (b); i --)
using namespace std;
void print() { cerr << endl; }
template<typename T, typename ...Ts>
void print(T v, Ts ...vs) { cerr << v << " "; print(vs...); }
typedef long long ll;
ll read() {
ll x = 0, f = 1; char ch = getchar();
while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getchar(); }
while(isdigit(ch)) { x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar(); }
return x * f;
}
const int N = 1e6 + 10;
char s[N];
int main() {
scanf("%s", s + 1);
int n = strlen(s + 1);
int mn = 1e9;
rep(l, 1, n) rep(r, 1, n) {
if(l > r + 1) continue;
int cnt = 0;
rep(i, 1, n) {
if(i >= l && i <= r) {
if(s[i] == '0') cnt ++;
} else if(s[i] == '1') cnt ++;
}
mn = min(mn, cnt);
}
cout << mn << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3780kb
input:
00011011001
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
11101111111111111101001011110111111110011101010110
output:
11
result:
ok 1 number(s): "11"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
00000000100000000000100000010001000
output:
3
result:
ok 1 number(s): "3"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
00000000000000000000000000000000000000000000000000
output:
0
result:
ok 1 number(s): "0"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
00000000100000000000100000011000
output:
2
result:
ok 1 number(s): "2"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
11000010100100000011101100000001000100000000000000
output:
8
result:
ok 1 number(s): "8"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
01100100111011110101010110000100001111110001110001
output:
19
result:
ok 1 number(s): "19"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1110101111001
output:
3
result:
ok 1 number(s): "3"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
1001
output:
1
result:
ok 1 number(s): "1"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
11111111111111111111111111111111111111111111111111
output:
0
result:
ok 1 number(s): "0"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
11111100000000001101010101100011
output:
9
result:
ok 1 number(s): "9"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
00011011001
output:
2
result:
ok 1 number(s): "2"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
11011
output:
1
result:
ok 1 number(s): "1"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
100011011
output:
2
result:
ok 1 number(s): "2"
Test #16:
score: -100
Wrong Answer
time: 0ms
memory: 3644kb
input:
0
output:
1
result:
wrong answer 1st numbers differ - expected: '0', found: '1'