QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#404536#4935. Exchange Bottleneckkevinyang#WA 4ms4616kbC++17432b2024-05-04 05:16:502024-05-04 05:16:51

Judging History

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

  • [2024-05-04 05:16:51]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:4616kb
  • [2024-05-04 05:16:50]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int>dp(n+1);
	vector<int>a(n+2);
	for(int i = 2; i<=n; i++){
		cin >> a[i];
	}
	int ans = 0;
	for(int i = 2; i<=n; i++){
		if(a[i]==1){
			dp[i] = 1;
		}
		else{
			dp[i] = dp[i-1]+1;
		}
		ans = max(ans,(dp[i]+2)/2);
	}
	cout << ans << '\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1 0 1 0

output:

2

result:

ok single line: '2'

Test #2:

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

input:

7
1 1 1 1 1 1

output:

1

result:

ok single line: '1'

Test #3:

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

input:

2
0

output:

1

result:

ok single line: '1'

Test #4:

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

input:

90580
1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 ...

output:

3

result:

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