QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#529013#9229. Juliet Unifies Onesucup-team2894#WA 0ms3940kbC++201.1kb2024-08-24 08:21:452024-08-24 08:21:45

Judging History

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

  • [2024-08-24 08:21:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3940kb
  • [2024-08-24 08:21:45]
  • 提交

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();
}

詳細信息

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'