QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#329313#4935. Exchange Bottleneckouo#WA 1ms9900kbC++17634b2024-02-16 16:01:552024-02-16 16:01:55

Judging History

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

  • [2024-02-16 16:01:55]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:9900kb
  • [2024-02-16 16:01:55]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long

using namespace std;

int n;
int arr[1000005];
int dp[1000005];
int ans;
int mini;

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);
    cin >> n;
    for (int i = 1; i < n; i++) {
        cin >> arr[i];
    }
    fill(dp, dp+n+1, 1e18);
    dp[1] = 0LL;
    dp[0] = 0LL;
    for (int i = 1; i < n; i++) {
        if (arr[i]) {
            dp[i+1] = 1LL;
        }else {
            dp[i+1] = dp[i]+1;
        }
        ans = max(dp[i+1], ans);
        //cout << i+1 << " " << dp[i+1] << " " << mini << "\n";
    }
    cout << ans;
    return 0;
}

详细

Test #1:

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

input:

5
1 0 1 0

output:

2

result:

ok single line: '2'

Test #2:

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

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: 0ms
memory: 9900kb

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:

5

result:

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