QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#300409 | #4935. Exchange Bottleneck | LeeShoW# | WA | 8ms | 3828kb | C++20 | 687b | 2024-01-08 10:45:54 | 2024-01-08 10:45:54 |
Judging History
answer
#include<iostream>
#include<algorithm>
#include<random>
#include<chrono>
#define pii pair<int,int>
using namespace std;
int main(){
int n;
cin>>n;
int all[n];
int pre=0;
int cnt=1;
int ans=1;
for(int i=0;i<n-1;i++){
cin>>all[i];
if(i==0){
if(all[i]==0){
cnt++;
}else{
cnt=1;
}
}else {
if(all[i]==0){
cnt++;
}else{
cnt=1;
}
}
pre=all[i];
ans=max(ans,cnt);
}
ans=min(ans,n-1);
cout<<ans<<endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3600kb
input:
5 1 0 1 0
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
7 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3476kb
input:
2 0
output:
1
result:
ok single line: '1'
Test #4:
score: -100
Wrong Answer
time: 8ms
memory: 3828kb
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:
5
result:
wrong answer 1st lines differ - expected: '2', found: '5'