QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#133465 | #4935. Exchange Bottleneck | PhantomThreshold# | WA | 1ms | 3540kb | C++20 | 511b | 2023-08-02 09:44:53 | 2023-08-02 09:44:57 |
Judging History
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'