QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#203796#4935. Exchange BottleneckAnwar#WA 0ms3868kbC++20728b2023-10-06 20:31:262023-10-06 20:31:26

Judging History

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

  • [2023-10-06 20:31:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3868kb
  • [2023-10-06 20:31:26]
  • 提交

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'