QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#297453#6310. Dining Professorsyokeff#WA 4ms3808kbC++17616b2024-01-04 14:36:082024-01-04 14:36:09

Judging History

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

  • [2024-01-04 14:36:09]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3808kb
  • [2024-01-04 14:36:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long  
int v[4];
signed main (){
	std::ios::sync_with_stdio(false);  
	cin.tie(NULL); 
	cout.tie(NULL);
	int n,a;
	cin>>n>>a;
	vector<int> c(n+3);
	int ans = 0;
	for(int i=1;i<=n;i++)
	{
		cin>>c[i];
		if(c[i]==1)
			ans +=3;
	}
	c[n+1] = c[1];
	c[n+2] = c[2];

	for(int i=2;i<=n+1;i++)
	{
		int num = 0;
		if(c[i-1]==0)
			num++;
		if(c[i]==0)
			num++;
		if(c[i+1]==0)
			num++;
		v[num]++;
	}
	a = n-a;
	int l = 3;
	while(a--)
	{	v[l]--;
		
		while(v[l]<=0)
			l--;
		
		ans +=l;
	}
	cout<<ans<<endl;
	
} 

详细

Test #1:

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

input:

5 2
1 0 1 0 1

output:

13

result:

ok 1 number(s): "13"

Test #2:

score: -100
Wrong Answer
time: 4ms
memory: 3808kb

input:

100000 33292
1 1 1 1 0 1 1 0 0 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 0 1 0 0 1 1 0 0 0 1 0 1 0 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 1 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 1 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 0 0...

output:

279234

result:

wrong answer 1st numbers differ - expected: '279236', found: '279234'