QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#549259#9229. Juliet Unifies Onespuppet#WA 0ms3612kbC++14649b2024-09-06 13:29:452024-09-06 13:29:46

Judging History

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

  • [2024-09-06 13:29:46]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3612kb
  • [2024-09-06 13:29:45]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
struct node 
{
	ll l,r;
}num[105];
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int main()
{
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	string s;
	cin>>s;
	ll l=0;
	ll ans=0;
	while(l<=s.size()-1)
	{
		ll r=l;
		while(r<=s.size()-1&&s[r]=='1')
		{
			r++;
		}
		if(r!=l)
		{
			num[++ans].l=l;
			num[ans].r=r-1;
			l=r;
		}
		l++;
	}
	ll cur=0;
	for(ll i=ans;i>=2;i--)
	{
		ll u1=num[i].r-num[i].l+1;
		ll u2=num[i].l-num[i-1].r-1;
		cur+=min(u1,u2);
	}
	cout<<cur<<"\n";
}

詳細信息

Test #1:

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

input:

00011011001

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

11101111111111111101001011110111111110011101010110

output:

10

result:

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