QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#315059#4935. Exchange Bottleneckyuyutw#WA 0ms3660kbC++14697b2024-01-26 21:09:432024-01-26 21:09:43

Judging History

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

  • [2024-01-26 21:09:43]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3660kb
  • [2024-01-26 21:09:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define io ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
#define MXN (ll)1e6+5
int main(){
    int n;
    cin >> n;
    int arr[n-1];
    int nw = 0, flag = 0, ans = 0, a1 = 0;
    for(int i=0;i<n-1;i++) {
        cin >> arr[i];
        if(i>0) {
            if(arr[i]) {
                flag = 1;
                a1++;
                nw = 0;
            } else {
                flag = 0;
                nw++;
            }
        }
    }
    if(a1 == n-1) {
        cout << 1 << endl;
    } else if(flag) {
        cout << 2 << endl;
    } else {
        cout << nw+1 << endl;
    }
 } 

詳細信息

Test #1:

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

input:

5
1 0 1 0

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3660kb

input:

7
1 1 1 1 1 1

output:

2

result:

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