QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#133465#4935. Exchange BottleneckPhantomThreshold#WA 1ms3540kbC++20511b2023-08-02 09:44:532023-08-02 09:44:57

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-02 09:44:57]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3540kb
  • [2023-08-02 09:44:53]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;

const int maxn = 210000;

int n;
int a[maxn];

int main()
{
	ios_base::sync_with_stdio(false);
	
	cin>>n;
	for(int i=1;i<n;i++) cin>>a[i];
	
	int cnt0=0;
	for(int i=1;i<n;i++)
	{
		if(a[i]==0) cnt0++;
	}
	if(cnt0==0) cout<<1<<endl;
	else if(a[n-1]==0)
	{
		int x=0;
		for(int i=n-1;i>=1&&a[i]==0;i--) x++;
		cout<<x+1<<endl;
	}
	else if(cnt0==1 && a[1]==0)
		cout<<1<<endl;
	else cout<<2<<endl;
	
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3468kb

input:

5
1 0 1 0

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

7
1 1 1 1 1 1

output:

1

result:

ok single line: '1'

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3468kb

input:

2
0

output:

2

result:

wrong answer 1st lines differ - expected: '1', found: '2'