QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#329315#4935. Exchange Bottleneckouo#WA 4ms6056kbC++17656b2024-02-16 16:02:162024-02-16 16:02:16

Judging History

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

  • [2024-02-16 16:02:16]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:6056kb
  • [2024-02-16 16:02:16]
  • 提交

answer

#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;

int n;
int arr[1000005];
int dp[1000005] = {0};
const int N = 1e6 + 5;

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);
    int mx = 0;
    cin >> n;
    int get0 = 0;
    for (int i = 2; i <= n; i++) {
        cin >> arr[i];
        if (i == 2) {
            dp[i] = 1;
        } else if (arr[i] || arr[i - 1]) {
            dp[i] = 2;
        } else {
            dp[i] = max(dp[i - 1] + 1, dp[i]);
        }
        if (arr[i] == 0)
            get0 = 1;
        else
            dp[i] = 1;
    }
    cout << dp[n];
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5632kb

input:

5
1 0 1 0

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 1ms
memory: 5692kb

input:

7
1 1 1 1 1 1

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 1ms
memory: 5724kb

input:

2
0

output:

1

result:

ok single line: '1'

Test #4:

score: -100
Wrong Answer
time: 4ms
memory: 6056kb

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'