QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#203796 | #4935. Exchange Bottleneck | Anwar# | WA | 0ms | 3868kb | C++20 | 728b | 2023-10-06 20:31:26 | 2023-10-06 20:31:26 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 3, MOD = 998244353;//1e9 + 7;
int32_t main() {
cin.tie(0);cin.sync_with_stdio(0);
cout.tie(0);cout.sync_with_stdio(0);
int n ;
cin >> n;
int ans= 1 ;
vector<int> a(n+1) ;
for(int i = 2; i <= n; i++) cin >> a[i] ;
vector<int> z;
for(int i =2 ; i <= n; i++) if(!a[i]) z.push_back(i) ;
if(z.empty() == 0) ans = max(ans , min(z.back() - z[0] , 2) ) ;
int mx_s =0 ;
while ( !a.empty() && a.back() == 0 ) mx_s++ , a.pop_back() ;
if(!a.empty())
{
mx_s++ ;
}
ans = max(ans , mx_s) ;
cout << ans ;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3576kb
input:
5 1 0 1 0
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
7 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3580kb
input:
2 0
output:
3
result:
wrong answer 1st lines differ - expected: '1', found: '3'