QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#686396#4935. Exchange BottleneckSanguineChameleon#WA 3ms4408kbC++20636b2024-10-29 12:06:152024-10-29 12:06:16

Judging History

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

  • [2024-10-29 12:06:16]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:4408kb
  • [2024-10-29 12:06:15]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
#define mp make_pair
#define eb emplace_back
#define pb push_back
typedef pair<int,int> pii;

int32_t main() {
    ios_base::sync_with_stdio(false);cin.tie(0);
    int n;
    cin>>n;
    int arr[n+5];
    for(int i=2;i<=n;i++){
        cin>>arr[i];
    }
    bool fc=1;
    for(int i=3;i<=n;i++){
        if(arr[i]==0)fc=0;
    }
    if(fc){
        cout<<"1\n";
        return 0;
    }
    int s=0;
    for(int i=n;i>=3;i--){
        if(arr[i]==0)s++;
        else break;
    }
    cout<<min(s+1,n-1);
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3572kb

input:

5
1 0 1 0

output:

2

result:

ok single line: '2'

Test #2:

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

input:

7
1 1 1 1 1 1

output:

1

result:

ok single line: '1'

Test #3:

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

input:

2
0

output:

1

result:

ok single line: '1'

Test #4:

score: -100
Wrong Answer
time: 3ms
memory: 4408kb

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:

1

result:

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