QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#529013 | #9229. Juliet Unifies Ones | ucup-team2894# | WA | 0ms | 3940kb | C++20 | 1.1kb | 2024-08-24 08:21:45 | 2024-08-24 08:21:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using ll = long long;
const int inf = 1e9 + 100;
const ll linf = 1e18 + 100;
using vi = vector<int>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
mt19937 rnd(time(0));
#define TIME (clock() * 1. / CLOCKS_PER_SEC)
using ld = double;
const ld PI = acosl(-1.L);
const int maxn = 1e6+10;
// const ll mod = 998244353;
ll a[maxn];
void solvee() {
string s;
cin >> s;
int n = s.size();
int ans = n;
for(int l=0;l<n;l++){
for(int r=l;r<n;r++){
int sc = 0;
for(int i=0;i<n;i++){
if(l<=i&&i<=r){
sc += (s[i]=='0');
}
else {
sc += (s[i]=='1');
}
}
ans = min(ans,sc);
}
}
cout << ans << "\n";
}
void solve() {
int tc = 1;
// cin >> tc;
while(tc--){
solvee();
}
}
signed main() {
// cin.tie(0)->sync_with_stdio(0);
// cin.exceptions(cin.failbit);
cout << fixed;
cout.precision(9);
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
00011011001
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
11101111111111111101001011110111111110011101010110
output:
11
result:
ok 1 number(s): "11"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
00000000100000000000100000010001000
output:
3
result:
ok 1 number(s): "3"
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3648kb
input:
00000000000000000000000000000000000000000000000000
output:
1
result:
wrong answer 1st numbers differ - expected: '0', found: '1'